当前位置: 首页>>代码示例>>C#>>正文


C# WebControls.Button类代码示例

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


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


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