Common ASP. NET development skills 2

Source: Internet
Author: User
12. horizontal panel scrolling and vertical auto Scaling <Asp: Panel style = "overflow-X: Scroll; overflow-Y: auto;"> </ASP: Panel>
13. Press enter to convert to Tab

<Script language = "JavaScript" for = "document" event = "onkeydown"> If (Eve nt. keycode = 13 & event. srcelement. type! = 'Button '& event. srcelement. type! = 'Submit '& event. srcelement. type! = 'Reset' & event. srcelement. type! = ''& Event. srcelement. type! = 'Textarea '); event. keycode = 9; </SCRIPT> onkeydown = "If (event. keycode = 13) event. keycode = 9" http://dotnet.aspx.cc/exam/enter2tab.aspx 14. DataGrid super join Column Datanavigateurlfield = "field name" datanavigateurlformatstring = "http: // XX/INC/Delete. aspx? Id = {0 }" 15. The row of the DataGrid changes color with the mouse Private void dgzf_itemdatabound (Object sender, system. Web. UI. webcontrols. datagriditemeventargs e) {If (E. Item. itemtype! = Listitemtype. header) {e. item. attributes. add ("onmouseout", "this. style. backgroundcolor = \ "" + E. item. style ["background-color"] + "\" "); E. item. attributes. add ("onmouseover", "this. style. backgroundcolor = \ "" + "# eff3f7" + "\"");}} 16. template Column <Asp: templatecolumn visible = "false" sortexpression = "Demo" headertext = "ID"> <itemtemplate> <asp: Label text = '<% # databinder. eval (container. dataitem, "ArticleID") %> 'runat = "server" width = "80%" id = "lblcolumn"/> </itemtemplate> </ASP: templatecolumn> <asp: templatecolumn headertext = "selected"> Code Protected void checkall_checkedchanged (Object sender, system. eventargs e) {// You can select all or all columns. Checkbox chkexport; If (checkall. checked) {foreach (datagriditem odatagriditem in mydatagrid. items) {chkexport = (checkbox) odatagriditem. findcontrol ("chkexport"); chkexport. checked = true ;}} else {foreach (maid in mydatagrid. items) {chkexport = (checkbox) odatagriditem. findcontrol ("chkexport"); chkexport. checked = false ;}}}
17. digit formatting

The result of <% # container. dataitem ("price") %> is 500.0000. How to format it to 500.00 ?] <% # Contain ("price", "{0: ¥ #,## 0.00}") %> int I = 123456; string S = I. tostring ("###,###. 00 "); 18. Date formatting [ASPX page: <% # databinder. eval (container. dataitem, "company_ureg_date") %> displayed as: 19:44:28 I only want: 2004-8-11] <% # databinder. eval (container. dataitem, "company_ureg_date", "{0: yyyy-m-d}") %> how to change it? [Format date], usually object (datetime) objectfromdb ). tostring ("yyyy-mm-dd"); [date validation expression]. correct input format: [], [10:29:39], [] ^ (\ D {2} ([02468] [048]) | ([2, 13579] [26]) [\-\/\ s]? ((( (0 ? [13578]) | (1 [02]) [\-\/\ s]? (0? [1-9]) | ([1-2] [0-9]) | (3 [01]) | (0? [469]) | (11) [\-\/\ s]? (0? [1-9]) | ([1-2] [0-9]) | (30) | (0? 2 [\-\/\ s]? (0? [1-9]) | ([1-2] [0-9]) | (\ D {2} ([02468] [1235679]) | ([13579] [01345789]) [\-\/\ s]? (0? [13578]) | (1 [02]) [\-\/\ s]? (0? [1-9]) | ([1-2] [0-9]) | (3 [01]) | (0? [469]) | (11) [\-\/\ s]? (0? [1-9]) | ([1-2] [0-9]) | (30) | (0? 2 [\-\/\ s]? (0? [1-9]) | (1 [0-9]) | (2 [0-8]) (\ s (0? [1-9]) | (1 [0-2]) \ :( [0-5] [0-9]) (\ s) | (\ :( [0-5] [0-9]) \ s) ([am | Pm | am | PM] {2, 2 })))? $ B. the following is the correct input format: [0001-12-31], [9999 09 30], [2002/03/03] ^ \ D {4} [\-\/\ s]? (0 [13578]) | (1 [02]) [\-\/\ s]? ([0-2] [0-9]) | (3 [01]) | (0 [469]) | (11 )) [\-\/\ s]? ([0-2] [0-9]) | (30) | (02 [\-\/\ s]? [0-2] [0-9]) $ [case-sensitive conversion] httputility. htmlencode (string); httputility. htmldecode (string)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.