1. After submitting the page, keep the position of the scroll bar
You can add the maintainscrollpositiononpostback command to the page command.
Reference content is as follows: <% @ Page Language = "C #" maintainscrollpositiononpostback = "true" autoeventwireup = "true" codefile = "..." inherits = "..." %> |
2. After loading the page, move the focus to a control. You only need to specify the defaultfocus attribute of the form.
Reference content is as follows: <Form ID = "frm" defaultfocus = "txtusername" runat = "server"> ... </Form> |
3. Set the default button of form through the defaultbutton attribute, that is, the button triggered when you press ENTER
Reference content is as follows: <Form ID = "frm" defaultbutton = "btnsubmit" runat = "server"> ... </Form> |
4. You can use the $ symbol to easily find the control using the findcontrol method.
Reference content is as follows:
name:
text = '<% # eval ("firstname") + "+ eval (" lastname ") %> '/>
|
In the preceding example, the defaultfocus attribute of form is used to specify the focus control for page loading. You can use the $ symbol to easily locate txtname.
You can also use the followingCodeTo easily find controls
Reference content is as follows: Textbox TB = This. findcontrol ("form1 $ formvw $ txtname") as textbox; If (TB! = NULL) { // Access Textbox Control } |