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


S

Sumit Rawat India

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 .
 
Ad

Advertisements

B

bruce barker

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)
 

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

Top