Home All Groups Group Topic Archive Search About

Changing RadioButton's NAme and ID properties using vb.net

Author
24 Mar 2006 9:03 AM
Savas Ates
I want to change my radiobutton's name ,id and value properties
programmatically.



RadioButton1.Attributes.Add("value", "Pele")

RadioButton1.Attributes.Add("name", "R1")

RadioButton1.Attributes.Add("id", "SAVAS")



It returns

<span name="R1" id="SAVAS" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px"><input id="RadioButton1" type="radio"
name="RadioButton1" value="Pele" /></span>



My first Html code is like that

<asp:RadioButton id="RadioButton1" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px"
    runat="server"></asp:RadioButton>

Author
24 Mar 2006 9:35 PM
jeff
Is your radio button HTML or ASP.NET??  If asp.net then do the following

in the page load event do this...
RadioButton1.Id = "value"
RadioButton1.Text = "mytext";

on the webpage add this

<asp:radiobutton1 runat="server" />

get all the juicy radiobutton information at msdn

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.
radiobutton_members.aspx