PC Review


Reply
Thread Tools Rating: Thread Rating: 16 votes, 3.50 average.

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

 
 
Tony Johansson
Guest
Posts: n/a
 
      27th Aug 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
 
      28th Aug 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
 
      28th Aug 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
Rate This Thread
Rate This Thread:

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
what is name attribute used for in this textbox web control Tony Johansson Microsoft C# .NET 2 28th Aug 2011 02:28 AM
How to find other attribute value corresponding searced attribute Andrus Microsoft C# .NET 1 26th Jun 2010 12:02 AM
"System.Web.HttpException: External component has thrown an exception" if OnSortCommand attribute is present in a datagrid control JT Microsoft ASP .NET 0 10th Nov 2006 07:07 AM
SEARCH XML ATTRIBUTE BASED ON THE VALUE OF ANOTHER ATTRIBUTE ATLANTA PATNAIK via DotNetMonster.com Microsoft C# .NET 2 12th Apr 2005 06:10 PM
asp:CheckBox has no Value attribute - Help !!! Fresh Air Rider Microsoft Dot NET 4 7th Mar 2004 04:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:36 AM.