Geeks With Blogs
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

You need to define which Textbox and Button you want to make them default.

// add the attribute in your form tag

<form id="form1" DefaultButton="Button1" DefaultFocus="TextBox2" runat="server">

Posted on Tuesday, September 5, 2006 9:39 AM .Net | Back to top


Comments on this post: Setting Default focus on TextBox & Button for ASP.NET 2.0

# re: Setting Default focus on TextBox & Button for ASP.NET 2.0
Requesting Gravatar...
nice,very simple,its working fine
Left by sreevi on Sep 30, 2008 8:48 AM

# re: Setting Default focus on TextBox & Button for ASP.NET 2.0
Requesting Gravatar...
I treid many attempts to use default focus on my text box and they all fail:
<form id="form1" DefaultFocus="tb2" runat="server">
Please Enter Password:
<asp:TextBox id="tb2" TextMode="password" runat="server" ></asp:TextBox>

Please help. Thanks.
Left by Ron Ehrlich on Jan 20, 2009 12:47 PM

Your comment:
 (will show your gravatar)


Copyright © Gaurav Taneja | Powered by: GeeksWithBlogs.net