Common ASP. NET development skills 3

Source: Internet
Author: User
19. How to set global variables Add application [attribute name] = xxx in application_start () event in global. asax; your global variable 20. How do I connect to the connection generated by hyperlinkcolumn and click Connect to open a new window? Hyperlinkcolumn has a property target, which can be set to "_ blank. (target = "_ blank") [aspnetmenu] Click the menu item to bring up a new window in your menudata. add urltarget = "_ blank" to the menu item of the XML file, for example: <? XML version = "1.0" encoding = "gb2312"?> <Menudata imagesbaseurl = "images/"> <menugroup> <menuitem label = "Reference Information" url = "infomation. aspx "> <menugroup id =" BBC "> <menuitem label =" announcement information "url =" infomation. aspx "urltarget =" _ blank "lefticon =" file.gif "/> <menuitem label =" "url =" newinfo. aspx "lefticon =" file.gif "/> ...... upgrade your aspnetmenu to version 1.2. 21. Delegate Discussion Http://community.csdn.net/Expert/topic/2651/2651579.xml? Temp =. 7183191 http://dev.csdn.net/develop/article/22/22951.shtm 22. Read the textbox value of the DataGrid Control. Foreach (DataGrid DGI in yourdatagrid. Items) {textbox TB = (textbox) DGI. findcontrol ("yourtextboxid"); TB. Text ....} 23. three template columns in the DataGrid contain textbox columns dg_shuliang (Quantity) dg_danjian (unit price) dg_jine (amount) in 5.6.7, respectively, it is required that the amount be calculated automatically when the quantity and unit price are entered: quantity * unit price = amount, and the input time limit must be numeric. how can I use a client script to implement this function? 〖〗 <Asp: templatecolumn headertext = "quantity"> <itemtemplate> <asp: textbox id = "shuliang" runat = 'server' text = '<% # databinder. eval (container. dataitem, "dg_shuliang") %> 'onkeyup = "javascript: Docal ()"/> <asp: regularexpressionvalidator id = "REVS" runat = "server" controltovalidate = "shuliang" errormessage = "must be integer" validationexpression = "^ \ D + $"/> </itemtemplate> </ ASP: templatecolumn> <asp: templatecolumn headerte XT = "unit price"> <itemtemplate> <asp: textbox id = "danjian" runat = 'server' text = '<% # databinder. eval (container. dataitem, "dg_danjian") %> 'onkeyup = "javascript: Docal ()"/> <asp: regularexpressionvalidator id = "revs2" runat = "server" controltovalidate = "danjian" errormessage = "must be numeric" validationexpression = "^ \ D + (\. \ D *)? $ "/> </Itemtemplate> </ASP: templatecolumn> <asp: templatecolumn headertext =" amount "> <itemtemplate> <asp: textbox id = "jine" runat = 'server' text = '<% # databinder. eval (container. dataitem, "dg_jine") %> '/> </itemtemplate> </ASP: templatecolumn> <script language = "JavaScript"> function Docal () {var E = event. srcelement; var ROW = E. parentnode. parentnode; var txts = row. all. tags ("input"); If (! Txts. length | txts. length <3) return; var q = txts [txts. length-3]. value; var P = txts [txts. length-2]. value; If (isnan (q) | isnan (p) return; q = parseint (Q); P = parsefloat (p); txts [txts. length-1]. value = (Q * P ). tofixed (2) ;}</SCRIPT>
24. Why do I always refresh the lower row selected by the DataGrid and scroll to the top? The selected row cannot be seen due to the relationship between the screen. Page_load page. smartnavigation = true 25. modify data in the DataGrid. When you click the edit key, the data appears in the text box. How to control the size of the text box? Private void maid (OBJ sender, maid e) {for (INT I = 0; I <E. item. cells. count-1; I ++) if (E. item. itemtype = listitemtype. edittype) {e. item. cells [I]. attributes. add ("width", "80px ")}} 26. Dialog Box Private Static string scriptbegin = "<script language = \" javascript \ ">"; Private Static string scriptend = "</SCRIPT>"; public static void confirmmessagebox (string pagetarget, string content) {string confirmcontent = "Var retvalue = Window. confirm ('"+ content +"'); "+" If (retvalue) {window. location = '"+ pagetarget +"';} "; confirmcontent = scriptbegin + confirmcontent + scriptend; Page parameterpage = (PAGE) system. web. httpcontext. current. handler; parameterpage. registerstartupscript ("Confirm", confirmcontent); // response. write (strscript );}
Come: http://dev.yesky.com/msdn/308/2162308.shtml

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.