在ajax中的UpdatePanel弹出对话窗,可以使用:
ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alert", "alert(‘更新成功!‘)", true);
修改后跳到另一个页面中去时,可以使用:
ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "click", "location.replace(‘UserManger.aspx‘);", true);
如果跳转前还有提示信息的话,则可以使用:
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert(‘更新成功!‘);location.replace(‘UserManger.aspx‘);", true);
例如:ScriptManager.RegisterStartupScript(this.UpdatePanel1,this.GetType(), "提示", "alert(‘购物车为空,请先购物!‘)", true);
protected void UpdatePanelAlert(string str_Message)
{
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "提示", "alert(‘" + str_Message + "‘)", true);
}
UpdatePanelAlert("无此代码");
/////////////////////////////////////////////////////////////////////////////////////////////
asp.net ajax框架UpdatePanel弹出提示的几种方法
2009-06-09 14:15
<asp:UpdatePanel runat="server" ID="p1"> 在ASP.NET的UpdatePanel中不能使用Response.write("")了,感觉不是很方便。 this.ClientScript.RegisterClientScriptBlock(this.GetType(),"a","alert(‘ok!‘);",true); for 1.0 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert(‘ok‘)", true); 关于updatepanel中注册执行javascript 好些天都在糊里糊涂,最近也比较懒,居然看到了个留言,永远不更新的博客一等奖,相当尴尬,哈哈。写一些最近自己或别人遇到的小问题吧。 <asp:TemplateField HeaderText="客户ID"> protected void gvClientInfo_RowCommand(object sender, GridViewCommandEventArgs e) 2、关于RegisterStartupScript,RegisterClientScriptBlock 3、关于“该行已经属于另一个表”错误 DataTable tmpdt = sodo.getDataTable("text", strSql, sp); |