javascript - 带有更新面板的内容页面未运行 javascript?
问题描述
我有一个 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"
如何弹出模态?一切都在更新面板中。
解决方案
我终于解决了
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(InitialiseSettings);
function InitialiseSettings(){
// replace your DOM Loaded settings here.
// If you already have document.ready event,
// just take the function part and replace here.
// Not with document.ready
$(element).slideUp(1000, method, callback});
$(element).slideUp({
duration: 1000,
easing: method,
complete: callback});
}
页面上的事件。
感谢这个链接。
https://stackoverflow.com/questions/14038684/execute-javascript-after-a-partial-postback-of-an-updatepanel
推荐阅读
- java - 是否可以在 Vaadin 14 和 RouterLink 中添加 uri 的#fragment 部分?
- c++ - 需要帮助了解 Stockfish 中使用的 uci.h 文件
- ios - 邮递员 GET 请求的 Alamofire 等效项
- php - 为什么我的前端 Wordpress 登录表单卡在重定向循环中?
- c++ - 分配 C++ 后指针的行为不符合预期
- android - Android谷歌地图,点击创建标记并立即开始拖动它
- regex - 如何使用带有正则表达式/特殊字符的 lstlisting 包?
- python - PyTorch - 调整图像大小的原因是什么以及如何确定最佳尺寸?
- amazon-web-services - 如何启用 (https) SSL 证书 AWS EC2 托管站点
- python - Discord.py - 如何在事件中调用命令?