Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > what is name attribute used for in this asp web control when ID has the same value

Reply
Thread Tools

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

 
 
Tony Johansson
Guest
Posts: n/a
 
      08-27-2011
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


 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      08-27-2011
On 8/27/2011 2:19 PM, Tony Johansson wrote:
> 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?


 
Reply With Quote
 
 
 
 
Jason Keats
Guest
Posts: n/a
 
      08-28-2011
Tony Johansson wrote:
> 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
>


http://stackoverflow.com/questions/1...ttributes-html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT Newbie: Attribute Value transformed to Attribute Name bprimuslevy XML 1 08-23-2006 09:56 PM
Change the value of an attribute according to the value of another attribute patrizio.trinchini@googlemail.com XML 8 08-22-2006 02:53 PM
wrapping long attribute value (line-continuation for attribute value) lophiomys@gmx.at XML 1 08-02-2006 01:18 PM
Selecting nodes ith the same attribute name value DiTieM XML 1 02-09-2006 12:52 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM



Advertisments