简体   繁体   English

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

[英]Content Page with updatepanel not running javascript?

I have a gridview,bootstrap modal that is inside update panel on a content page which references master page. 我有一个gridview,bootstrap模式,它位于引用母版页的内容页面上的更新面板内。

There are 3 columns in my gridview and a linkbutton. 我的gridview中有3列和一个linkbutton。

When Linkbutton event is fired javascript should be fired which isn't. 当Linkbutton事件被触发时,应该触发javascript而不是。

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

I tried this but gives me sys undefined error in console. 我试过这个,但在控制台中给了我sys未定义的错误。

Here's my code: 这是我的代码:

GridView -> View Button -> 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);

also tried with 也尝试过

//ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "MyFunction", "funct1()", true);

Here's my javacript := 这是我的javacript:=

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

How to up pop up modal ? 如何弹出模态? everything is in updatepanel. 一切都在updatepanel中。

I finally ended up solving with 我终于最终解决了

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

event on page. 页面上的活动。

Thanks to this link. 感谢这个链接。

https://stackoverflow.com/questions/14038684/execute-javascript-after-a-partial-postback-of-an-updatepanel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM