updatepanel没有运行javascript的内容页面?

问题描述 投票:0回答:1

我有一个gridview,bootstrap模式,它位于引用母版页的内容页面上的更新面板内。

我的gridview中有3列和一个linkbutton。

当Linkbutton事件被触发时,应该触发javascript而不是。

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(funct1);

我试过这个,但在控制台中给了我sys未定义的错误。

这是我的代码:

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);

这是我的javascript:=

function funct1() {
            $('#<%=MandateView.ClientID%>').modal("toggle");
            return false;
        } // div id="MandateView"

如何弹出模态?一切都在updatepanel中。

javascript c# asp.net updatepanel
1个回答
0
投票

我终于最终解决了

    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
© www.soinside.com 2019 - 2024. All rights reserved.