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


C# WebControls.RadioButtonList类代码示例

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


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

示例1: Page_Load

		private void Page_Load(object sender, System.EventArgs e) 
		{
			HtmlForm frm  = (HtmlForm)FindControl("Form1");
			GHTTestBegin(frm);

			//Negative CellPadding value:
			GHTSubTestBegin("Negative CellPadding value");
			try 
			{
				System.Web.UI.WebControls.RadioButtonList rbl = new System.Web.UI.WebControls.RadioButtonList();
				rbl.RepeatLayout = RepeatLayout.Table;
				rbl.CellPadding = -100;
				GHTSubTestExpectedExceptionNotCaught("ArgumentOutOfRangeException");
			}
			catch (ArgumentOutOfRangeException ex)
			{
				GHTSubTestExpectedExceptionCaught(ex);
			}
			catch (Exception ex) 
			{
				GHTSubTestUnexpectedExceptionCaught(ex);
			}
			GHTSubTestEnd();

			GHTTestEnd();
		}
开发者ID:nobled,项目名称:mono,代码行数:26,代码来源:RadioButtonList_CellPadding.aspx.cs

示例2: McssWebQuestion

 public McssWebQuestion(string strId, bool bRequired, string strRequiredText, string strQuestion, string strControlBase, RepeatDirection rdLayout, string[] strResponses)
     : base(strId, "mcss", bRequired, strRequiredText, strQuestion)
 {
     this.m_radioButtonList = new RadioButtonList();
     this.m_dropDownList = new DropDownList();
     this.m_listControl = null;
     if (strControlBase == "dropdown")
     {
         this.m_listControl = this.m_dropDownList;
     }
     else
     {
         this.m_radioButtonList.RepeatDirection = rdLayout;
         this.m_listControl = this.m_radioButtonList;
     }
     foreach (string text in strResponses)
     {
         this.m_listControl.Items.Add(new ListItem(text));
     }
     this.m_listControl.ID = "lst_" + strId;
     if (bRequired)
     {
         ListControlValidator child = new ListControlValidator();
         child.EnableClientScript = false;
         child.Text = strRequiredText;
         child.Display = ValidatorDisplay.Dynamic;
         child.ControlToValidate = this.m_listControl.ID;
         this.Controls.Add(child);
     }
     this.Controls.Add(this.m_listControl);
     this.Controls.Add(new LiteralControl("</p>"));
 }
开发者ID:italiazhuang,项目名称:wx_ptest,代码行数:32,代码来源:McssWebQuestion.cs

示例3: CreateChildControls

        //Override the Create Child Controls event
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            //label for radio button list
            lblTFQuestion = new Label();
            lblTFQuestion.ID = "lblTFQuestion";
            lblTFQuestion.AssociatedControlID = "uxTFQuestion";
            lblTFQuestion.Text = QuestionText;

            //create radio button list
            uxTFQuestion = new RadioButtonList();
            uxTFQuestion.ID = "uxTFQuestion";

            //create validation for radio button list
            reqTFQuestion = new RequiredFieldValidator();
            reqTFQuestion.ID = "reqTFQuestion";
            reqTFQuestion.Display = ValidatorDisplay.Dynamic;
            reqTFQuestion.Text = "*";
            reqTFQuestion.ControlToValidate = "uxTFQuestion";
            reqTFQuestion.ErrorMessage = "No radio selection";

            //create and add list items true and false
            ListItem listTrue = new ListItem("true", "true");
            ListItem listFalse = new ListItem("False", "False");
            uxTFQuestion.Items.Add(listTrue);
            uxTFQuestion.Items.Add(listFalse);

            //add label, radio button list and validator to controls
            Controls.Add(lblTFQuestion);
            Controls.Add(uxTFQuestion);
            Controls.Add(reqTFQuestion);
        }
开发者ID:Deliv3rat0r,项目名称:CST465,代码行数:34,代码来源:TrueFalseQuestion.cs

示例4: SelectItem

 /// <summary>
 /// Selects and item in the radio button list control by the item value.
 /// This is available as a property of the control in .Net 1.1
 /// </summary>
 /// <param name="control"></param>
 /// <param name="value"></param>
 public static void SelectItem(RadioButtonList control, string value)
 {
     control.ClearSelection();
     ListItem item = control.Items.FindByValue(value);
     if (item != null)
         item.Selected = true;
 }
开发者ID:williamesharp,项目名称:Aspose_Email_NET,代码行数:13,代码来源:WebUtil.cs

示例5: DynamicRadioButtonList

        public DynamicRadioButtonList()
        {
            controlXML = new DynamicRadioButtonListXml();

            _tbControls = new Table();
            _trControls = new TableRow();
            _tdLabel = new TableCell();
            _tdControl = new TableCell();
            _tdRequired = new TableCell();
            _trControls.Cells.Add(_tdLabel);
            _trControls.Cells.Add(_tdControl);
            _trControls.Cells.Add(_tdRequired);
            _tbControls.Rows.Add(_trControls);

            _radioButtonList = new RadioButtonList();
            _radioButtonList.CausesValidation = false;
            _radioButtonList.RepeatDirection = RepeatDirection.Horizontal;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;

            _tdControl.Controls.Add(_radioButtonList);
            _tdRequired.Controls.Add(_required);
            this.Controls.Add(_tbControls);
        }
开发者ID:danilocecilia,项目名称:HulcherProject,代码行数:28,代码来源:DynamicRadioButtonList.cs

示例6: CreateChildControls

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Label lblQuestion = new Label();
            _rdoAnswer = new RadioButtonList();
            RequiredFieldValidator valQuestion = new RequiredFieldValidator();

            lblQuestion.ID = "lbl" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            _rdoAnswer.ID = "rdo" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            valQuestion.ID = "val" + _question.QuestionGuid.ToString().Replace("-", String.Empty);

            lblQuestion.Text = _question.QuestionText;
            lblQuestion.AssociatedControlID = _rdoAnswer.ID;

            valQuestion.ControlToValidate = _rdoAnswer.ID;
            valQuestion.Enabled = _question.AnswerIsRequired;

            foreach (QuestionOption option in _options)
            {
                ListItem li = new ListItem(option.Answer);
                if (li.Value == _answer) li.Selected = true;
                _rdoAnswer.Items.Add(li);
            }

            valQuestion.Text = _question.ValidationMessage;

            Controls.Add(lblQuestion);
            Controls.Add(_rdoAnswer);
            Controls.Add(valQuestion);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:30,代码来源:RadioButtonListQuestion.cs

示例7: CreateChildControls

        protected override void CreateChildControls()
        {
            this.Controls.Clear();

            this._optionsRadioButtons = new RadioButtonList();
            this._optionsRadioButtons.ID = RADIO_LIST_ID;
            this._optionsRadioButtons.Items.Clear();

            System.Diagnostics.Debug.Assert(this.Items.Count > 0, "Count is not greater Than 0");
            if (this.Items.Count > 0)
            {
                foreach (ListItem li in this.Items)
                {
                    this._optionsRadioButtons.Items.Add(li);
                }

                this._validator = new RequiredFieldValidator();
                this._validator.ControlToValidate = RADIO_LIST_ID;
                this._validator.ErrorMessage = this.RequiredErrorMessage;
                this._optionsRadioButtons.CausesValidation = true;
            }

            this.Controls.Add(this._optionsRadioButtons);
            if (this._validator != null)
            {
                this.Controls.Add(this._validator);
            }
        }
开发者ID:pragmaticpat,项目名称:EdwardsFoundation,代码行数:28,代码来源:MultipleChoiceControl.cs

示例8: CreateChildControls

        protected override void CreateChildControls()
        {
            //base.CreateChildControls();
            lnkAnadir = new ImageLinkButton();
            lnkAnadir.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(ContainerRibbon), "Inventio.Engine.Resources.img.cambiar.png");
            lnkAnadir.ImageWidth = new Unit(16, UnitType.Pixel);
            lnkAnadir.Text = "Cambiar gadget";
            lnkAnadir.Click += new EventHandler(btnAnadir_Click);
            //ButtonHelper.CreateButton(ref btnAnadir, "Seleccionar Gadget", btnAnadir_click);
            this.Controls.Add(this.lnkAnadir);

            this.PanelGadgets = new Panel();
            this.PanelGadgets.CssClass = "ListaGadgets";
            radList = new RadioButtonList();
            this.PanelGadgets.Controls.Add(radList);

            lnkAceptar = new ImageLinkButton();
            lnkAceptar.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(ContainerRibbon), "Inventio.Engine.Resources.img.ok.gif");
            lnkAceptar.ImageWidth = new Unit(16, UnitType.Pixel);
            lnkAceptar.Text = "Aceptar";
            lnkAceptar.Click += new EventHandler(lnkAceptar_Click);
            this.PanelGadgets.Controls.Add(this.lnkAceptar);

            lnkCancelar = new ImageLinkButton();
            lnkCancelar.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(ContainerRibbon), "Inventio.Engine.Resources.img.cancel.png");
            lnkCancelar.ImageWidth = new Unit(16, UnitType.Pixel);
            lnkCancelar.Text = "Cancelar";
            lnkCancelar.Click += new EventHandler(lnkCancelar_Click);
            this.PanelGadgets.Controls.Add(this.lnkCancelar);

            this.Controls.Add(this.PanelGadgets);
        }
开发者ID:carlozzer,项目名称:InventioEngine,代码行数:32,代码来源:ContainerRibbon.cs

示例9: LlenarRadioBL_Web

 public bool LlenarRadioBL_Web( RadioButtonList Generico )
 {
     if ( ! Validar() )
             return false;
         clsConexionBD objConexionBd = new clsConexionBD( strApp );
         try
         {
             objConexionBd.SQL = strSQL;
             if ( ! objConexionBd.LlenarDataSet( false ) )
             {
                 strError = objConexionBd.Error;
                 objConexionBd.CerrarCnx();
                 objConexionBd = null;
                 return false;
             }
             Generico.DataSource = objConexionBd.DataSet_Lleno.Tables[0];
             Generico.DataValueField = strCampoID;
             Generico.DataTextField = strCampoTexto;
             Generico.DataBind();
             objConexionBd.CerrarCnx();
             objConexionBd = null;
             return true;
         }
         catch (Exception ex)
         {
             strError = ex.Message;
             return false;
         }
 }
开发者ID:jdzapataduque,项目名称:Cursos-Capacitando,代码行数:29,代码来源:clsLlenarRBList.cs

示例10: BindMaritaStatus

 public static RadioButtonList BindMaritaStatus(RadioButtonList rbList, string texto, string valor)
 {
     try
     {
     if (SPContext.Current != null)
     {
       using (Microsoft.SharePoint.SPWeb web = SPContext.Current.Web)
       {
         BLL.MaritalStateBLL bll = new CAFAM.WebPortal.BLL.MaritalStateBLL(web);
         DataSet ds = bll.GetMaritalStateList();
         BindList(rbList, ds, texto, valor);
       }
     }
     else
     {
       using (SPSite site = new SPSite(SP_SITE))
       {
         using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())
         {
             BLL.MaritalStateBLL bll = new CAFAM.WebPortal.BLL.MaritalStateBLL(web);
             DataSet ds = bll.GetMaritalStateList();
             BindList(rbList, ds, texto, valor);
         }
       }
     }
     }
     catch (Exception ex)
     {
     throw ex;
     }
     return rbList;
 }
开发者ID:gcode-mirror,项目名称:chafam,代码行数:32,代码来源:ListBinder.cs

示例11: Page_Load

		private void Page_Load(object sender, System.EventArgs e) 
		{
			HtmlForm frm = (HtmlForm)FindControl("form1");
			GHTTestBegin(frm);

			//Non valid RepeatColumns value
			GHTSubTestBegin("Non valid RepeatColumns value");
			try 
			{
				System.Web.UI.WebControls.RadioButtonList rbl = new System.Web.UI.WebControls.RadioButtonList();
				rbl.RepeatColumns = -1;
				GHTSubTestExpectedExceptionNotCaught("ArgumentOutOfRangeException");
			}
			catch (ArgumentOutOfRangeException ex)
			{
				GHTSubTestExpectedExceptionCaught(ex);
			}
			catch (Exception ex) 
			{
				GHTSubTestUnexpectedExceptionCaught(ex);
			}
			GHTSubTestEnd();

			GHTTestEnd();

		}
开发者ID:nobled,项目名称:mono,代码行数:26,代码来源:RadioButtonList_RepeatColumns.aspx.cs

示例12: CreateChildControls

        protected override void CreateChildControls()
        {
            this.Title = "Custom Wingtip Properties";

              txtUserGreeting = new TextBox();
              txtUserGreeting.TextMode = TextBoxMode.MultiLine;
              txtUserGreeting.Width = new Unit("100%");
              txtUserGreeting.Rows = 2;

              lstFontSizes = new RadioButtonList();
              lstFontSizes.Font.Size = new FontUnit("7pt");
              lstFontSizes.Items.Add("14");
              lstFontSizes.Items.Add("18");
              lstFontSizes.Items.Add("24");
              lstFontSizes.Items.Add("32");

              lstFontColors = new RadioButtonList();
              lstFontColors.Font.Size = new FontUnit("7pt");
              lstFontColors.Items.Add("Black");
              lstFontColors.Items.Add("Green");
              lstFontColors.Items.Add("Blue");
              lstFontColors.Items.Add("Purple");

              Controls.Add(new LiteralControl("<div class='WingtipEditorDiv'>Type a user greeting:</div>"));
              Controls.Add(txtUserGreeting);
              Controls.Add(new LiteralControl("<div class='WingtipEditorDiv'>Select font point size:</div>"));
              Controls.Add(lstFontSizes);
              Controls.Add(new LiteralControl("<div class='WingtipEditorDiv'>Select font color:</div>"));
              Controls.Add(lstFontColors);
        }
开发者ID:kimberpjub,项目名称:GSA2013,代码行数:30,代码来源:CustomProperties3Editor.cs

示例13: RadioButtonListItem

        /// <summary>
        /// Initializes a new instance of the <see cref="Adf.Web.UI.RadioButtonListItem"/> class with the specified label and radio button list.
        /// </summary>
        /// <param name="label">The <see cref="System.Web.UI.WebControls.Label"/> that defines display text of the radio button list within <see cref="Adf.Web.UI.BasePanelItem"/>.</param>
        /// <param name="list">The <see cref="System.Web.UI.WebControls.RadioButtonList"/> that defines the control which will be added into <see cref="Adf.Web.UI.BasePanelItem"/>.</param>
        public RadioButtonListItem(Label label, RadioButtonList list)
        {
            List = list;

            _labelControls.Add(label);

            _itemControls.Add(list);
        }
开发者ID:NLADP,项目名称:ADF,代码行数:13,代码来源:RadioButtonListItem.cs

示例14: GetRadioButtonList

        private static RadioButtonList GetRadioButtonList(string id, string keys, string values, string selectedValues)
        {
            RadioButtonList list = new RadioButtonList();
            list.ID = id;
            list.ClientIDMode = System.Web.UI.ClientIDMode.Static;

            list.RepeatDirection = RepeatDirection.Horizontal;
            Helper.AddListItems(list, keys, values, selectedValues);
            return list;
        }
开发者ID:ravikumr070,项目名称:mixerp,代码行数:10,代码来源:RadioButtonList.cs

示例15: CreateControlInternal

        protected override WebControl CreateControlInternal(Control container)
        {
            _radioButtonList = new RadioButtonList  { ID = ID + "_RadioButtonList", RepeatColumns = 1, RepeatDirection = RepeatDirection.Vertical, RepeatLayout = RepeatLayout.Flow};

            container.Controls.Add(_radioButtonList);

            if (ListSource != null)
            {
                BindList();
            }

            return _radioButtonList;
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:13,代码来源:DnnFormRadioButtonListItem.cs


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