今天,我把GridView放在UpdatePanel中,其中每行都有一些操作,有一个是修改,要求弹出模式窗口,在模式窗口中修改,如果用普通的方法ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script></script>");不会有任何反应
要想在UpdatePanel中弹出窗口,要用不同的方法,如下:
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.alert('Hello!'); </script>", false);
要想显示相应的模式窗口,方法如下:
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.showModalDialog('ModifyNews.aspx?NewsId=" + newsId + "','','status=no;dialogWidth=550px;dialogHeight=500px;menu=no;resizeable=yes;scroll=yes;center=yes;edge=raise')</script>", false);
我想,其中的差别就在于第二个方法里多了一个参数this.page,如有兴趣,可以私下讨论... ...
要想在UpdatePanel中弹出窗口,要用不同的方法,如下:
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.alert('Hello!'); </script>", false);
要想显示相应的模式窗口,方法如下:
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.showModalDialog('ModifyNews.aspx?NewsId=" + newsId + "','','status=no;dialogWidth=550px;dialogHeight=500px;menu=no;resizeable=yes;scroll=yes;center=yes;edge=raise')</script>", false);
我想,其中的差别就在于第二个方法里多了一个参数this.page,如有兴趣,可以私下讨论... ...