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

Discussion in 'ASP .Net' started by Tony Johansson, Aug 27, 2011.

  1. 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
    Tony Johansson, Aug 27, 2011
    #1
    1. Advertising

  2. Tony Johansson

    Arne Vajhøj Guest

    Re: what is name attribute used for in this asp web control whenID has the same value

    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?
    Arne Vajhøj, Aug 28, 2011
    #2
    1. Advertising

  3. Tony Johansson

    Jason Keats Guest

    Re: what is name attribute used for in this asp web control whenID has the same value

    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/1397592/difference-between-id-and-name-tag-attributes-html
    Jason Keats, Aug 28, 2011
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DiTieM
    Replies:
    1
    Views:
    507
    Martin Honnen
    Feb 9, 2006
  2. Replies:
    1
    Views:
    4,275
    Joe Kesselman
    Aug 2, 2006
  3. Replies:
    8
    Views:
    522
  4. bprimuslevy
    Replies:
    1
    Views:
    438
    Soren Kuula
    Aug 23, 2006
  5. Replies:
    2
    Views:
    262
    Thomas J. Gritzan
    Feb 13, 2007
Loading...

Share This Page