updatepanel中使用jscript脚本

    技术2022-05-20  44

    网页上使用ajax、updatepanel,updatepanel内有个Gridview,Gridview中有个按钮进行Response.Redirect,点击按钮时出现如下错误:sys.webforms.pagerequestmanagerparsererrorexception。

     

    查了原因,原来在updatepanel中不能使用类似response.redirect,response.write等脚本,于是使用ScriptManager.RegisterStartupScript()就好了。

     

    具体为:

     string url = "window.location.href='addrizhi.aspx?id="+ id  + "'";

                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", url, true);


    最新回复(0)