Default focus on control in asp.net

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>