Solve the problem of using updatepanel in Ajax and then using response. Write ();.

Source: Internet
Author: User

System. Web. UI. scriptmanager. registerstartupscript to replace page. clientscript. registerstartupscript
Function prototype:
System. Web. UI. scriptmanager. registerstartupscript (contrl control, type, string key, string script, bool addscripttags );
Parameters:
Control ----------------- to register the Control ID of this JavaScript statement, as shown in the following example:
Type -------------------- this parameter is the type of the registered script block control, that is, the updatepanel type. You can use this. GetType () directly.
Key --------------------- indicates the name of the cirpt statement to be executed.
Script ------------------ JavaScript statement
When addscripttags is set to true, you do not need to write JavaScript labels for the script parameter on the front. If it is set to false, you need to add the <script language = 'javascript '> </SCRIPT> label for the script parameter.

Note: One more control parameter is required. If the control is in updatepanel, the operation is completed. If the control is not in updatepanel, this step is not allowed.
For example:

System. web. UI. scriptmanager. registerstartupscript (btntestthis. getType (), "test", "alert (''test''); window. close (); ", true );

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.