what is name attribute used for in this asp web control when ID has the same value

T

Tony Johansson

When this text box web control
<asp:TextBox ID="txt" runat="server" />
is sent to the browser a name attribute is added. As you can see the ID
attribute has the same value as the name attribute.
So my question is what is the point in that having two attribute with the
same value ?
<input type="text" ID="txt" name="txt" />

//Tony
 
A

Arne Vajhøj

When this text box web control
<asp:TextBox ID="txt" runat="server" />
is sent to the browser a name attribute is added. As you can see the ID
attribute has the same value as the name attribute.
So my question is what is the point in that having two attribute with the
same value ?
<input type="text" ID="txt" name="txt" />

As I read the docs, then name is not an ASP.NET control
attribute but an HTML INPUT attribute that ASP.NET just
passes on.

So I think you should only use id and let ASP.NET generate
name based on that.

Arne

PS: Why not cross post instead of multi post?
 

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

No members online now.

Forum statistics

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

Latest Threads

Top