【发布时间】:2019-09-03 22:57:46
【问题描述】:
我有一个 gridview、bootstrap 模式,它位于引用母版页的内容页面上的更新面板内。
我的网格视图中有 3 列和一个链接按钮。
当 Linkbutton 事件被触发时,javascript 应该被触发,但不是。
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(funct1);
我试过了,但在控制台中给了我 sys undefined 错误。
这是我的代码:
GridView -> 查看按钮 ->
var link = (Control)sender;
GridViewRow row = (GridViewRow)link.NamingContainer;
Label LiD = (Label)row.FindControl("LabelID");
id = Convert.ToInt32(LiD.Text);
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "funct1()", true)
MandateDetailusingId(id);
也试过
//ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "MyFunction", "funct1()", true);
这是我的 javacript :=
function funct1() {
$('#<%=MandateView.ClientID%>').modal("toggle");
return false;
} // div id="MandateView"
如何弹出模态?一切都在更新面板中。
【问题讨论】:
-
查看stackoverflow.com/a/45442175/5836671,了解
PageRequestManager的正确使用方法 -
@VDWWD 我试过你的方法,它会在加载时弹出模态。在按钮单击时,它会触发 sys undefined。
标签: javascript c# asp.net updatepanel