Work Summary (II)-Tips

Source: Internet
Author: User

2008 is far away from us, and 2009 has arrived for almost two months. 2009 of the work pressure will grow bigger and bigger in the future, and we hope our technology can go further.

1. Get GUID ()
ProgramMedium: guid. newguid (). tostring (). Replace ("-", ""). toupper ();
SQL: Replace (newid (),'-','')
2. Ajax pop-up window
Scriptmanager. registerclientscriptblock (button1, button1.gettype (), "onclick", "alert ('added successfully'); window. location. href = 'default. aspx '; ", true); [available in vs2008]

3. how to Prevent Users From clicking
protected void page_load (Object sender, eventargs e)
{< br> If (! Ispostback)
This. button1.attributes. add ("onclick", "this. disabled = 'false'; "+ this. getpostbackeventreference (button1);
}< br>
protected void button1_click1 (Object sender, eventargs e)
{< br> If (! Page. isvalid) return;
for (INT I = 0; I <20000; I ++)
{< br> Kong + = "AA" + I. tostring ();
}< br> ....
}

4. How to Prevent JS files from being referenced after a file references a master page?

Method 1: Add a reference to the CS file on the master page.
This. Page. clientscript. registerclientscriptinclude ("testinclude", this. Context. response. applyapppathmodifier ("~ /Cminclude/fslbasecsript. js "));

Method 2: add reference to the page file on the master page
<LINK rel = "stylesheet" href = "<% = page. resolveclienturl ("~ /CSS/web_css.css ") %>" type = "text/CSS">
<Script language = "JavaScript" src = "<% = page. resolveclienturl ("~ /Mmweb/JavaScript/common. js ") %>"> </SCRIPT>

5. Obtain the path
Request. url. Host get the Host Header of this instance;
Request. url. absoluteuri get the absolute URL;
Request. url. absolutepath get absolute path

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.