在Ajax1.0中使用Response.Redirect()

昨天,朋友的程序asp.net2.0想使用Ajax1.x版本。其中有一个button,需要做页面转跳Response.Redirect(),当一点击按钮时,发生不想看到的异常:

sys.WebForms,PageRequestManagerParsesErrorExceptio n: The message received from the server could be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near ‘ </div>

|<html>
<head>
‘ .

朋友来电说,他想使用Insus.NET一个组件:http://www.cnblogs.com/insus/articles/1341703.html 来解决。

obj.jsAlert("","this","Default.aspx"); 这样写的话,会有一个无字窗口,点击确认之后,才转跳,就不会出现上面的异常。

因此要求Insus.NET是否可以更改这个DLL,加多一个方法重载,作为可以直接转跳页面的功能。

 

由于这个算不上Javascript方面的问题,Insus.NET想不必去改这个DLL。因此Insus.NET使用下面方法远程协助帮他把问题解决,解决方法如下:

View Code
 protected void Button1_Click(object sender, EventArgs e)
    {
       
// Response.Redirect("~/Default.aspx");
        
        Button button 
= (Button)sender;
        button.PostBackUrl 
= "~/Default.aspx";
    }

 

posted @ 2011-09-10 11:17  Insus.NET  阅读(506)  评论(0编辑  收藏  举报