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

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>
 
C

CaffieneRush

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.
 
C

CaffieneRush

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top