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

  • Thread starter Thread starter Savas Ates
  • Start date Start date
S

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>
 
RadioButton1.ID = "SAVAS"
In place of the value attribute, you can use the text attribute.
RadioButton1.Text = "Pele"
The name attribute is deprecated in the xhtml standard and it's role is
replaced by ID.

Regards.
 
By the way the <span ...>...</span> html block is the client side code
- it's what you see when you look at the source of the browser side
code.

The <asp:RadioButton ...></asp:RadioButton> code block is the server
side page - what you see in Visual Studio source view.

The ASP.NET framework would render the server tags at runtime to
specific html tags that is suitable for the browser on the client
making the http request (adaptive rendering).

Regards.
 
Back
Top