web 2.0

How to change default button of a form

Often, we have condition when we have multiple forms on a page which have multiple submit buttons as well. Whenever, you press enter on any text box it will call the command button which is at top most sequence of command buttons.

So, to overcome this problem here is the little code. Take your each set of fields and button in a panel and specify the default Button Property. In the example below I have a form which have two buttons one is command button and another is an image button and I am setting the second button of the sequence to get called each time enter key press on the panel. (rather then the top most)

   1: <asp:Panel ID="pnl1" runat="server" DefaultButton="ImageButton1">
   2:         <asp:TextBox ID="TextBox1" runat="server">
   3:         </asp:TextBox>
   4:         <asp:Button ID="Button1" runat="server" Text="Submit" />
   5:         <asp:ImageButton ID="ImageButton1" runat="server" />
   6:     </asp:Panel>

Comments

5 point harness booster seat United States, on 11/1/2009 5:08:34 AM Said:

5 point harness booster seat

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

wholesale bling United States, on 11/2/2009 6:18:53 AM Said:

wholesale bling

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

build magnetic generator United States, on 11/2/2009 9:32:50 AM Said:

build magnetic generator

Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful.

Free Online Games United States, on 11/6/2009 1:25:17 PM Said:

Free Online Games

Just wanted to give you a shout from the valley of the sun, great information. Much appreciated.

Keller tx homes for sale United States, on 11/14/2009 10:45:08 AM Said:

Keller tx homes for sale

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment.
Is there any way you can remove me from that service?
Thanks!

Wealthy Affiliate United States, on 11/16/2009 1:04:07 PM Said:

Wealthy Affiliate

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post

offense basketball plays United States, on 11/18/2009 12:59:32 PM Said:

offense basketball plays

Have you ever considered adding more videos to your blog posts to keep the readers more entertained? I mean I just read through the entire article of yours and it was quite good but since I'm more of a visual learner,I found that to be more helpful well let me know how it turns out! I love what you guys are always up too. Such clever work and reporting! Keep up the great works guys I've added you guys to my blogroll. This is a great article thanks for sharing this informative information.. I will visit your blog regularly for some latest post.

Forever Marine Mask United States, on 11/19/2009 12:14:51 PM Said:

Forever Marine Mask

Have you ever considered adding more videos to your blog posts to keep the readers more entertained? I mean I just read through the entire article of yours and it was quite good but since I'm more of a visual learner,I found that to be more helpful well let me know how it turns out! I love what you guys are always up too. Such clever work and reporting! Keep up the great works guys I've added you guys to my blogroll. This is a great article thanks for sharing this informative information.. I will visit your blog regularly for some latest post.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading