Two useful attributes and methods are added in ASP. NET 2.0:
Setfocus () is used to focus the cursor on a page control. <% @ Page Language = " C # " %>
< Script runat = " Server " >
Void Page_init ( Object Sender, eventargs E)
{
Setfocus (focushere );
}
</ Script >
< Html >
< Head ID = " Head1 " Runat = " Server " >
< Title > Untitled page </ Title >
</ Head >
< Body >
< Form ID = " Form1 " Runat = " Server " >
< ASP: textbox ID = " Default " Runat = " Server " /> < BR />
< ASP: textbox ID = " Focushere " Runat = " Server " />
</ Form >
</ Body >
</ Html >
When maintainscrollpositiononpostback is set to true, the position of the page scroll bar can be maintained when the page is PostBack.
Make the following settings in Web. config:<Pages smartnavigation="True"Maintainscrollpositiononpostback="True"/>
Original article: http://www.cnblogs.com/necboy/archive/2006/02/17/332631.html