• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WebControls.Button类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.UI.WebControls.Button的典型用法代码示例。如果您正苦于以下问题:C# Button类的具体用法?C# Button怎么用?C# Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Button类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Button类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetLoginInterface

        /// <summary>
        /// Must create and return the control 
        /// that will show the logon interface.
        /// If none is available returns null
        /// </summary>
        public Control GetLoginInterface(Style controlStyle)
        {
            this._uIdTable = new Table();
            TableCell cell = new TableCell();
            TableRow row = new TableRow();
            Button child = new Button();
            child.Click += new EventHandler(this.OnUIdSubmit);

            this._uIdTextBox = new TextBox();
            this._uIdTextBox.CssClass = "lddl";
            //this._uIdTable.ControlStyle.Font.CopyFrom(controlStyle.Font);
            this._uIdTable.ControlStyle.CssClass = "tablelddl ";
            this._uIdTable.Width = Unit.Percentage(100.0);
            child.Text = ResourceManager.GetString("SubmitUId");
            child.CssClass = "btn btn-primary btn-xs bw";

            cell.Controls.Add(new LiteralControl(ResourceManager.GetString("EnterUIdMessage", this.LanguageCode)));
            row.Cells.Add(cell);
            this._uIdTable.Rows.Add(row);
            cell = new TableCell();
            row = new TableRow();
            cell.Controls.Add(this._uIdTextBox);
            cell.Controls.Add(child);
            row.Cells.Add(cell);
            this._uIdTable.Rows.Add(row);
            return this._uIdTable;
        }
开发者ID:ChrisNelsonPE,项目名称:surveyproject_main_public,代码行数:32,代码来源:EmailWebSecurityAddIn.cs


示例2: create_request_table

        public void create_request_table(string stg1, string stg2)
        {
            TableRow row = new TableRow();
            TableCell cell1 = new TableCell();
            cell1.Text = "<h4 class = 'font-thai font-1d8'>" + stg1 + "</h4>";
            row.Cells.Add(cell1);
            cell1 = new TableCell();
            cell1.Text = "<h4 class = 'font-thai font-1d8'>" + stg2 + "</h4>";
            row.Cells.Add(cell1);
            cell1 = new TableCell();
            Button bt = new Button();
            bt.CssClass = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent";
            bt.Text = "ยืนยัน";
            bt.Click += delegate
            {
                teacher_delete(stg1);

            };
            cell1.Controls.Add(bt);
            bt = new Button();
            bt.CssClass = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored";
            bt.Text = "ดู";
            cell1.Controls.Add(bt);
            bt = new Button();
            bt.CssClass = "mdl-button mdl-js-button mdl-button--accent";
            bt.Text = "ไม่ยืนยัน";
            bt.Click += delegate
            {
                teacher_delete(stg1);

            };
            cell1.Controls.Add(bt);
            row.Cells.Add(cell1);
            request_view_table.Rows.Add(row);
        }
开发者ID:sahakornb,项目名称:2015_SWeng_Project,代码行数:35,代码来源:main.aspx.cs


示例3: CreateChildControls

        protected override void CreateChildControls()
        {
            // base.CreateChildControls();
            // Add Literal Controls
            this.Controls.Add(new LiteralControl("<h3>Value: "));

            // Add Textbox
            TextBox box = new TextBox();
            box.Text = "0";
            box.TextChanged +=new EventHandler(this.TextBox_Changed);
            this.Controls.Add(box);

            // Add Literal Controls
            this.Controls.Add(new LiteralControl("</h3>"));

            // Add "Add" Button
            Button addButton = new Button();
            addButton.Text = "Add";
            addButton.Click += new EventHandler(this.AddBtn_Click);
            this.Controls.Add(addButton);

            // Add Literal Controls
            this.Controls.Add(new LiteralControl(" | "));

            // Add "Subtract" Button
            Button subtractButton = new Button();
            subtractButton.Text = "Subtract";
            subtractButton.Click += new EventHandler(this.SubtractBtn_Click);
            this.Controls.Add(subtractButton);

        }
开发者ID:renyh1013,项目名称:dp2,代码行数:31,代码来源:TestControl2.cs


示例4: Ini

 public override void Ini()
 {
     CssClass = "_devices";
     burnerList = new Dictionary<string, Devices>();
     burnerList = ((Bake)deviceList[name]).GetBurnerList();
     bakeOvenList = ((Bake)deviceList[name]).GetBakeOvenList();
     panelName = new Panel();
     panelName.CssClass = "_bakePanelName";
     labelName = new Label();
     labelName.Text = name;
     panelName.Controls.Add(labelName);
     buttonDelete = new Button();
     buttonDelete.Text = "X";
     buttonDelete.CssClass = "_buttonDelete";
     buttonDelete.Click += Delete_Click;
     Controls.Add(panelName);
     Controls.Add(buttonDelete);
     foreach (var burner in burnerList)
     {
         Controls.Add(((IDraw)burner.Value).Draw(burner.Key, burnerList));
     }
     foreach (var oven in bakeOvenList)
     {
         Controls.Add(((IDraw)oven.Value).Draw(oven.Key, bakeOvenList));
     }
 }
开发者ID:anatoliyshulika,项目名称:HomeWebForm,代码行数:26,代码来源:BakeDraw.cs


示例5: ComputerMove

        private static void ComputerMove()
        {
            Random rand = new Random();
            int positionIndex = rand.Next(0, freePositions.Count);
            Position position = freePositions[positionIndex];
            int row = position.X;
            int col = position.Y;

            if (game[row, col] == '*')
            {
                game[row, col] = computerCharacter;
                freePositions.Remove(position);
                Button btn = new Button();
                Page page = new Page();
                if (HttpContext.Current != null)
                {
                    page = (Page)HttpContext.Current.Handler;
                    btn = (Button)page.FindControl("Btn" + row + col);
                    btn.Text = computerCharacter.ToString();
                }
                if (Win(computerCharacter))
                {
                    Label lbWinner = (Label)page.FindControl("Winner");
                    lbWinner.Text = "You win!";
                    lbWinner.Visible = true;
                    computerScores++;
                    UpdateScores(page);
                    return;
                }
            }
            else
            {
                ComputerMove();
            }
        }
开发者ID:Tsvetomir-Kirchev,项目名称:Telerik-Academy-Exercises,代码行数:35,代码来源:default.aspx.cs


示例6: View

        /// <summary>
        /// Initializes a new instance of the <see cref="View" /> class.
        /// </summary>
        protected View()
            : base(HtmlTextWriterTag.Div)
        {
            Presenter = new Presenter(this);
            _answerCountLabel = new Label()
            {
                Text = ResourceHelper.GetString("AnswerCountDropDownLabel")
            };

            _answerCountDropDown = new DropDownList()
            {
                AutoPostBack = true
            };

            QuestionComposerControl = new QuestionComposer()
            {
                QuestionLabelText = ResourceHelper.GetString("QuestionLabelText"),
                AnswerLabelText = ResourceHelper.GetString("AnswerLabelText"),
                FractionLabelText = ResourceHelper.GetString("FractionLabelText"),
                ValidatorErrorMessage = ResourceHelper.GetString("FractionValidatorErrorMessage"),
                IsVisibleLabelText = ResourceHelper.GetString("IsVisibleLabelText")
            };

            _generateXmlButton = new Button()
            {
                Text = ResourceHelper.GetString("GenerateXMLButtonText")
            };

            _generateXmlButton.Click += GenerateXmlButton_Click;
        }
开发者ID:camil666,项目名称:MoodleQuestions,代码行数:33,代码来源:View.cs


示例7: CreateChildControls

        protected override void CreateChildControls()
        {
            Random random = new Random();
            _firstInt = random.Next(0, 20);
            _secondInt = random.Next(0, 20);

            ResourceManager rm = new ResourceManager("SystemWebExtensionsAUT.LocalizingClientResourcesWalkthrough.VerificationResources", this.GetType().Assembly);
            Controls.Clear();

            _firstLabel = new Label();
            _firstLabel.ID = "firstNumber";
            _firstLabel.Text = _firstInt.ToString();

            _secondLabel = new Label();
            _secondLabel.ID = "secondNumber";
            _secondLabel.Text = _secondInt.ToString();

            _answer = new TextBox();
            _answer.ID = "userAnswer";

            _button = new Button();
            _button.ID = "Button";
            _button.Text = rm.GetString("Verify");
            _button.OnClientClick = "return CheckAnswer();";

            Controls.Add(_firstLabel);
            Controls.Add(new LiteralControl(" + "));
            Controls.Add(_secondLabel);
            Controls.Add(new LiteralControl(" = "));
            Controls.Add(_answer);
            Controls.Add(_button);
        }
开发者ID:nobled,项目名称:mono,代码行数:32,代码来源:ClientVerification.cs


示例8: Page_Init

 protected void Page_Init(object sender, EventArgs e)
 {
     FineUI.Button btn = new Button();
     btn.Text = "工具栏中的按钮数(动态添加的按钮)";
     btn.Click += new EventHandler(btn_Click);
     Toolbar1.Items.Add(btn);
 }
开发者ID:proson,项目名称:Fine-UI,代码行数:7,代码来源:menu_dynamic2.aspx.cs


示例9: CreateChildControls

        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls 
        /// that use composition-based implementation to create any child controls
        /// they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            m_MainPanel = new UpdatePanel();
            m_MainPanel.RenderMode = UpdatePanelRenderMode.Inline;

            // The next two lines ensure that nothing is sent to the client,
            // as there's no information to send anyway. This reduces overhead.
            m_MainPanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
            m_MainPanel.ChildrenAsTriggers = false;

            Controls.Add(m_MainPanel);

            m_TypeBox = new TextBox();
            m_TypeBox.ID = "Type";
            m_TypeBox.EnableViewState = false;
            m_TypeBox.ValidationGroup = "Communicator";
            m_MainPanel.ContentTemplateContainer.Controls.Add(m_TypeBox);

            m_MessageBox = new TextBox();
            m_MessageBox.ID = "Message";
            m_MessageBox.EnableViewState = false;
            m_MessageBox.ValidationGroup = "Communicator";
            m_MainPanel.ContentTemplateContainer.Controls.Add(m_MessageBox);

            m_SubmitButton = new Button();
            m_SubmitButton.ID = "Submit";
            m_MessageBox.EnableViewState = false;
            m_SubmitButton.ValidationGroup = "Communicator";
            m_SubmitButton.Click += new EventHandler(SubmitButton_Click);
            m_MainPanel.ContentTemplateContainer.Controls.Add(m_SubmitButton);

        }
开发者ID:ChrisNikkel,项目名称:Umbraco-CMS,代码行数:39,代码来源:Communicator.cs


示例10: CreateChildControls

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            TitleLabel = new Label();
            TitleLabel.Text = "Titel";
            this.Controls.Add(TitleLabel);

            TitleTextBox = new TextBox();
            this.Controls.Add(TitleTextBox);

            BodyLabel = new Label();
            BodyLabel.Text = "Text";
            this.Controls.Add(BodyLabel);

            BodyTextArea = new TextBox();
            BodyTextArea.TextMode = TextBoxMode.MultiLine;
            this.Controls.Add(BodyTextArea);

            ExpireLabel = new Label();
            ExpireLabel.Text = "Ablaufdatum";
            this.Controls.Add(ExpireLabel);

            ExpireTextBox = new TextBox();
            this.Controls.Add(ExpireTextBox);

            AddButton = new Button();
            AddButton.Text = "Hinzufügen";
            AddButton.ID = "AddButton";
            AddButton.Click += AddButtonClick;
            this.Controls.Add(AddButton);
        }
开发者ID:AndreKraemer,项目名称:Samples,代码行数:31,代码来源:AnnouncementControl.cs


示例11: CreateChildControls

        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            var tbl = new Table();
            var row = new TableRow();
            var cell = new TableCell
                {
                    ColumnSpan = 2,
                    VerticalAlign = VerticalAlign.Middle,
                    HorizontalAlign = HorizontalAlign.Center
                };

            var lblTitle = new Label {Text = "This WebPart will send a parameter to a consumer:"};
            cell.Controls.Add(lblTitle);
            row.Controls.Add(cell);
            tbl.Controls.Add(row);

            row = new TableRow();
            cell = new TableCell {VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center};
            _textBox = new TextBox {Text = "", Width = Unit.Pixel(120)};
            cell.Controls.Add(_textBox);
            row.Controls.Add(cell);
            cell = new TableCell {VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center};
            _button = new Button {Text = "Send..."};
            _button.Click += btn_Click;
            cell.Controls.Add(_button);
            row.Controls.Add(cell);
            tbl.Controls.Add(row);

            Controls.Add(tbl);
        }
开发者ID:SSabet,项目名称:SP2013-Short-Course,代码行数:32,代码来源:Provider+Web+Part.cs


示例12: _TestStyle

		public static void _TestStyle (Page p)
		{
			Button b = new Button ();
			b.BackColor = Color.Red;
			b.ID = "Yoni";
			p.Controls.Add (b);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:Class1.cs


示例13: setToEditionMode

        /// <summary>
        /// Method <c>setToEditionMode</c> is used when the gadgetContainer is shown
        /// in cockpit edition page.
        /// </summary>
        public void setToEditionMode()
        {
            gadgetTitle.Text = "";

            gadgetPanel.Style.Add("height", gadget.getHeight().ToString()+"px");
            gadgetPanel.Style.Add("width", this.gadgetContainerPanel.Width.ToString()+"px");
            gadgetPanel.BackColor = System.Drawing.ColorTranslator.FromHtml("#83a1bd");

            Label lblGadgetName = new Label();
            lblGadgetName.Text = gadget.getUniqueID() + " - " + gadget.getName();
            lblGadgetName.Style.Add("font-size", "20px");
            gadgetPanel.Controls.Add(lblGadgetName);

            Button btnRemoveGadget = new Button();
            btnRemoveGadget.ID = "btnRemoveGadget" + gadget.getUniqueID();
            btnRemoveGadget.Style.Add("background-image", "url(Images/stop-12x12.png)");
            btnRemoveGadget.Style.Add("background-repeat", "no-repeat");
            btnRemoveGadget.Style.Add("width", "13px");
            btnRemoveGadget.Style.Add("height", "16px");
            btnRemoveGadget.CommandArgument = gadget.getUniqueID().ToString();
            //handler used when user remove the gadget
            EventHandler btnHandler = new EventHandler(removeGadget);
            btnRemoveGadget.Click += btnHandler;

            header.Controls.Add(btnRemoveGadget);
        }
开发者ID:biolls08,项目名称:Cockpit-ContractX,代码行数:30,代码来源:GadgetContainer.ascx.cs


示例14: SetBtnStatus

        /// <summary>
        /// 根据参数,控制按钮的显示或隐藏
        /// </summary>
        /// <param name="InCheck">是否是在审核状态下</param>
        /// <param name="DateStatus">数据状态</param>
        /// <param name="btnEdit">修改保存按钮</param>
        /// <param name="btnSubmit">提交按钮</param>
        /// <param name="btnReturn">返回按钮</param>
        public void SetBtnStatus(bool InCheck, string DateStatus, Button btnEdit, Button btnSubmit, Button btnReturn, Button btnAtt)
        {
            //根据明细判断:审核用(按钮全隐藏)
            //数据状态:0保存未提交(可修改);1提交待审批;2审批通过(不可修改);3退回(可修改);4审批暂停(可修改)

            if (InCheck) //如果是审核状态,则隐藏按钮
            {
                if (btnEdit != null)
                    btnEdit.Visible = false;
                if (btnSubmit != null)
                    btnSubmit.Visible = false;
                if (btnReturn != null)
                    btnReturn.Visible = false;
                if (btnAtt != null)
                    btnAtt.Visible = false;
            }
            else if (DateStatus == "0" || DateStatus == "3" || DateStatus == "4") //可修改和提交
            {
                if (btnEdit != null)
                    btnEdit.Enabled = true;
                if (btnSubmit != null)
                    btnSubmit.Enabled = true;
                if (btnAtt != null)
                    btnAtt.Enabled = true;
            }
            else if (DateStatus == "1" || DateStatus == "2") //不可修改和提交
            {
                if (btnEdit != null)
                    btnEdit.Enabled = false;
                if (btnSubmit != null)
                    btnSubmit.Enabled = false;
                if (btnAtt != null)
                    btnAtt.Enabled = false;
            }
        }
开发者ID:inspire88,项目名称:TcportGroupOA,代码行数:43,代码来源:CommonFun.cs


示例15: InitializeSkin

 protected override void InitializeSkin(System.Web.UI.Control Skin)
 {
     LogTitle = (TextBox)Skin.FindControl("LogTitle");
     Search = (Button)Skin.FindControl("Search");
     Search.Click += new EventHandler(Search_Click);
     //throw new NotImplementedException();
 }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:7,代码来源:SearchLog.cs


示例16: InstantiateIn

		public void InstantiateIn(Control objContainer)
		{
			Button btn = new Button();
			btn.CommandName = strCommandName;
			btn.DataBinding += new EventHandler(btn_DataBinding);
			objContainer.Controls.Add(btn);
		}
开发者ID:bsimser,项目名称:spforums,代码行数:7,代码来源:DataGridRT.cs


示例17: CreateChildControls

        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            base.Controls.Clear();

            _dfltShowButton = new Button();
            base.Controls.Add(_dfltShowButton);
            _dfltShowButton.ID = "default";
            _dfltShowButton.Attributes.Add("style","display:none");

            _dialogPanel = new Panel();
            base.Controls.Add( _dialogPanel );
            _dialogPanel.ID = "panel";
            _dialogPanel.CssClass = "rock-modal-frame";
            _dialogPanel.Attributes.Add("style","display:none");

            _contentPanel = new Panel();
            _dialogPanel.Controls.Add( _contentPanel );
            _contentPanel.ID = "contentPanel";
            _contentPanel.CssClass = "iframe";

            _iFrame = new HtmlGenericControl( "iframe" );
            _iFrame.ID = "iframe";
            _iFrame.Attributes.Add( "scrolling", "no" );
            _contentPanel.Controls.Add( _iFrame );

            this.PopupControlID = _dialogPanel.ID;
        }
开发者ID:Ganon11,项目名称:Rock,代码行数:31,代码来源:ModalIFrameDialog.cs


示例18: AddAdress

        protected void AddAdress(string id)
        {
            // 用以显示地址编号的Label.
            Label lb = new Label();
            lb.Text = "地址" + id + ": ";

            // 用以输入地址的TextBox.
            TextBox tb = new TextBox();
            tb.ID = "TextBox" + id;

            if (id != "1")
            {
                // 可以尝试不带判定条件下的这句代码.
                // 单击Save按钮后会有很奇怪的行为.
                tb.Text = Request.Form[tb.ID];
            }

            // 用以检查地址的Button.
            // 同时演示如何绑定事件到一个动态控件上.
            Button btn = new Button();
            btn.Text = "检查";
            btn.ID = "Button" + id;

            // 使用+=运算符绑定事件.
            btn.Click += new EventHandler(ClickEvent);

            Literal lt = new Literal() { Text = "<br />" };

            // 作为一个组件添加这些控件到pnlAddressContainer.
            pnlAddressContainer.Controls.Add(lb);
            pnlAddressContainer.Controls.Add(tb);
            pnlAddressContainer.Controls.Add(btn);
            pnlAddressContainer.Controls.Add(lt);
        }
开发者ID:zealoussnow,项目名称:OneCode,代码行数:34,代码来源:Default.aspx.cs


示例19: CreateLinks

        private TableCell CreateLinks(SoftwareDto software)
        {
            var tc = new TableCell();
            var btnDetail = new Button
            {
                Text = "Details",
                CssClass = "btn btn-info",
                ID = "btnDetail_" + software.Id,
                PostBackUrl = "SoftwareDetails.aspx?id=" + software.Id
            };

            var btnEdit = new Button
            {
                ID = "btnEdit_" + software.Id,
                Text = "Edit",
                CssClass = "btn btn-warning",
                PostBackUrl = "SoftwareEdit.aspx?id=" + software.Id
            };
            var btnDelete = new Button { Text = "Delete", CssClass="btn btn-danger" };
            
            tc.Controls.Add(btnDetail);
            tc.Controls.Add(new Label() { Text = " " });
            tc.Controls.Add(btnEdit);
            tc.Controls.Add(new Label() { Text = " " });
            tc.Controls.Add(btnDelete);
            return tc;
        }
开发者ID:twerner93,项目名称:LicenseManagerNet,代码行数:27,代码来源:Softwares.aspx.cs


示例20: displayShow

        private void displayShow(PlaceHolder placeholder, int shid)
        {
            placeholder.Controls.Clear();
            Show show = new Show();
            show.id = Convert.ToInt32(Request["shid"]);
            show.get();

            TextBox tickets = new TextBox();
            tickets.ID = "numOfTickets";

            Button order = new Button();
            order.Text = "Order!";
            order.Click += new System.EventHandler(this.orderClick);

            HiddenField hiddenShid = new HiddenField();
            hiddenShid.Value = shid.ToString();
            hiddenShid.ID = "hiddenShid";

            placeholder.Controls.Add(new LiteralControl("<h1>"+show.read("moid", true)+" @ "+show.read("show_start")+"</h1>"));
            placeholder.Controls.Add(new LiteralControl("<p>### tickets left</p>"));
            placeholder.Controls.Add(new LiteralControl("<p>Please input # of tickets you want to order</p>"));
            placeholder.Controls.Add(tickets);
            placeholder.Controls.Add(order);
            placeholder.Controls.Add(new LiteralControl("<br /><br /><a href=\"order_ticket.aspx\">Back to show list</a>"));
            placeholder.Controls.Add(hiddenShid);
        }
开发者ID:cmol,项目名称:cinemaxxx,代码行数:26,代码来源:order_ticket.aspx.cs



注:本文中的System.Web.UI.WebControls.Button类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebControls.CheckBox类代码示例发布时间:2022-05-26
下一篇:
C# WebControls.BoundField类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap