Tuesday, February 22, 2011

Focus particular textbox in page bydefault (like google) & on enter key press hit button from page(like google search button)

This are very easy things to do,
when we open any page & we want particular textbox contains cursor & after pressing enter button particular button gets clicked then do the following things
in page contains a form tag , It contains defaultbutton & defaultfocus attributes set it as per your requirement
defaultbutton:= give your buttons name which u want to clicked
defaultfocus:= give control name for which you want focus after page load
<form id="form1" runat="server" defaultbutton="Button1" defaultfocus="TextBox1">
 Here  TextBox1 contains cursor & after press enter Button1's click event gets called

No comments:

Post a Comment