Saturday, January 8, 2011

Default focus on control in webpage

Default focus on control in asp.net



You can set default focus on particular control of your webpage.

<form> tag has one attribute called “defaultfocus” you can assign the ID of control to which you want default focus.

Assigning ID is case-sensitive here.



Code snippet:

   <form id="form1" defaultfocus= "TextBox1" runat="server" >



     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

No comments:

Post a Comment