Regarding autogeneration of name attribute of input tag(Asp.net bu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U3VtaXQgUmF3YXQgSW5kaWE=?=

    #1

    Regarding autogeneration of name attribute of input tag(Asp.net bu

    What I have seen in Asp.net applications that if i put two Asp buttons on the
    web form(Aspx page)
    it generates multiple name attribute of input tag on the client side.
    for eg.

    <asp:Button ID="btn" value="first" runat="server" name="btnname"/>
    <asp:Button ID="Button1" value="second" runat="server" name="btnname"/>


    After the execution it shows the result in following way:--


    <input type="submit" name="btn" value="" id="btn" value="first"
    name="btnname" />
    <input type="submit" name="Button1" value="" id="Button1" value="second"
    name="btnname" />


    Here the problem looks that the "name" parameter has two values now one is
    "Button1" and second is "btnname"
    Which i think is incorrect


    is their any explaination to this .

  • bruce barker

    #2
    Re: Regarding autogeneration of name attribute of input tag(Asp.netbu

    its a bug in your code. asp:buttons do not have a name property. by
    convention, any unknown properties of a server control are rendered as
    attributes. the asp:button renders it own name attribute so it can
    receive a postback (and fire the click). you should not use the name
    attribute with any server control based on the html elements input,
    select or textarea.

    -- bruce (sqlwork.com)

    Sumit Rawat India wrote:
    What I have seen in Asp.net applications that if i put two Asp buttons on the
    web form(Aspx page)
    it generates multiple name attribute of input tag on the client side.
    for eg.
    >
    <asp:Button ID="btn" value="first" runat="server" name="btnname"/>
    <asp:Button ID="Button1" value="second" runat="server" name="btnname"/>
    >
    >
    After the execution it shows the result in following way:--
    >
    >
    <input type="submit" name="btn" value="" id="btn" value="first"
    name="btnname" />
    <input type="submit" name="Button1" value="" id="Button1" value="second"
    name="btnname" />
    >
    >
    Here the problem looks that the "name" parameter has two values now one is
    "Button1" and second is "btnname"
    Which i think is incorrect
    >
    >
    is their any explaination to this .
    >

    Comment

    Working...