问题描述:
英语翻译
Now when thePageRequestManager is informed of an error,it will redirect the browser toErrorPage.aspx.It also adds an aspxerrorpath query string argument to the URLthat indicates the URL of the page where the problem originated,as shown here:
You can writecode in ErrorPage.aspx that reads the aspxerrorpath information.For example,you might include a Retry button that redirects the user to the originalrequested page,like this:
string url = Request.QueryString["aspxerrorpath"];
if (url = null) Response.Redirect(url);
If your websiteuses custom error pages but you don’t want them to apply to asynchronouspostbacks,you must set the ScriptManager.AllowCustomErrorsRedirect property tofalse.
In complexpages,you might have more than one UpdatePanel.In this case,when oneUpdatePanel triggers an update,all the UpdatePanel regions will be refreshed.
However,if youhave more than one UpdatePanel and each one is completely self-contained,thisisn’t necessary.In this situation,you can configure the panels to updatethemselves independently.Simply change the UpdatePanel.UpdateMode propertyfrom Always to Conditional.Now the UpdatePanel will refresh itself only if anevent occurs in one of the controls in that UpdatePanel.
To try this out,create a page that has several UpdatePanel controls,each with itsbutton.Thenadd code that places the current time in the label of all three controls:
protected voidPage_Load(object sender,EventArgs e)
{ lblTime1.Text = DateTime.Now.ToLongTimeString();
lblTime2.Text =DateTime.Now.ToLongTimeString();
lblTime3.Text =DateTime.Now.ToLongTimeString();}
When you clickone of the Refresh Time buttons,only the label in that panel will be updated.The other panels will remain untouched.
Now when thePageRequestManager is informed of an error,it will redirect the browser toErrorPage.aspx.It also adds an aspxerrorpath query string argument to the URLthat indicates the URL of the page where the problem originated,as shown here:
You can writecode in ErrorPage.aspx that reads the aspxerrorpath information.For example,you might include a Retry button that redirects the user to the originalrequested page,like this:
string url = Request.QueryString["aspxerrorpath"];
if (url = null) Response.Redirect(url);
If your websiteuses custom error pages but you don’t want them to apply to asynchronouspostbacks,you must set the ScriptManager.AllowCustomErrorsRedirect property tofalse.
In complexpages,you might have more than one UpdatePanel.In this case,when oneUpdatePanel triggers an update,all the UpdatePanel regions will be refreshed.
However,if youhave more than one UpdatePanel and each one is completely self-contained,thisisn’t necessary.In this situation,you can configure the panels to updatethemselves independently.Simply change the UpdatePanel.UpdateMode propertyfrom Always to Conditional.Now the UpdatePanel will refresh itself only if anevent occurs in one of the controls in that UpdatePanel.
To try this out,create a page that has several UpdatePanel controls,each with itsbutton.Thenadd code that places the current time in the label of all three controls:
protected voidPage_Load(object sender,EventArgs e)
{ lblTime1.Text = DateTime.Now.ToLongTimeString();
lblTime2.Text =DateTime.Now.ToLongTimeString();
lblTime3.Text =DateTime.Now.ToLongTimeString();}
When you clickone of the Refresh Time buttons,only the label in that panel will be updated.The other panels will remain untouched.
问题解答:
我来补答展开全文阅读