Monday, September 1, 2008

Set the default focus to a control when the page loads

 This is extremely simple thing that can be done without resorting to writing JavaScript. If you only have a single textbox (or two) on a page why should the user have to click in the textbox to start typing? Shouldn't the cursor already be blinking in the textbox so they can type away? Using the DefaultFocus property of the HtmlForm control you can easily do this. 

< form id="frm" DefaultFocus="txtUserName" runat="server" >
  ...
</form>

No comments: