1. Use the methods supported by the Framework to register scripts,
(1) registerarraydeclaration outputs the array definition to the page
(2) registerclientscriptblock output script (followed by this from)
(3) registerclientscriptinclude Add a reference to the script
(4) registerclientscriptresource Obtains resources from the Assembly
(5) add additional properties to the control using registerexpandoattribute
(6) Add a hidden control to registerhiddenfield
(7) registeronsubmitstatement can be used to add a statement and return a value. If it is true, it will be successfully submitted next time.
(8) registerstartupscript outputs the script to the page (followed by/from)
You can use the method below scriptmanage to replace
2. updatepanel attribute 1: rendermode is divided into two values: block contains content with Div, inline contains content with span
3. updatemode attribute: it is also divided into two values: always, all actions are refreshed, and conditional is refreshed only by the internally active control.
4. childrenastriggers: whether to send asynchronous requests. If it is set to false, setting updatemode to always will cause an exception.
5. triggers setting controls that trigger updatepanel
6. scriptmanager. getcurrent (this). registerasyncpostbackcontrol (this. button1 );
Scriptmanager. getcurrent (this). registerpostbackcontrol (this. button2 );
Set trigger in code
Protected void button#click (Object sender, eventargs E)
{
This. updatepanel1.update ();
}
7. In updateprogress, you can set associatedupdatepanelid to specify the updatepan to be triggered, displayafter to set the delay time, And dynamiclayout to specify whether to occupy a space during hiding.
Error Handling: Server
8. allowcustomerrorsredirect attribute in scriptmanager: whether to redirect due to an error in Web. config
9. asyncpostbackerror event: the event triggered when an error occurs during asynchronous refresh.
1 protected void scriptmanagerpolicasyncpostbackerror (Object sender, asyncpostbackerroreventargs E)
2 {
3 scriptmanager. getcurrent (this). asyncpostbackerrormessage = E. Exception. message;
4}
10. asyncpostbackerrormessage attribute: error message received by the client
Client:
Responds to the endrequest event of pagerequestmanager.
Set the errorhandled attribute to true.
1 SYS. webforms. pagerequestmanager. getinstance (). add_endrequest (function (sender, E)
2 {
3 E. set_errorhandled (true );
4 $ get ("error"). innerhtml = "sorry, an error has occurred:" + E. get_error (). message;
5 setTimeout (function () {$ get ("error"). innerhtml = "" ;}, 3000 );
6 });