【问题标题】:Prevent the closing of modal popup(bootstrap) window on postback of ASP.Net button click防止在 ASP.Net 按钮单击回发时关闭模式弹出(引导)窗口
【发布时间】:2021-03-05 13:56:55
【问题描述】:

我在 asp.net 页面中有模态弹出窗口,它在单击提交按钮时从 db 获取一些值,并在相同的模态弹出窗口中显示该 db 值。 但问题是,一旦我单击 asp.net 按钮,它就会获取值,但我需要在其中显示由于回发而已经关闭的 db 值。 所以我需要在按钮上单击第一个服务器端运行,检索 db val,然后运行客户端脚本以在已打开的模式中显示此值。 请帮我解决这个问题

我的客户端代码正在单击按钮。

    $("#btnSubmit").click(function () {

        $('#PreviewModal').hide();
        $('#SubmitModal').ready();
        $('#SubmitModal').show();

    });

服务器端脚本是

protected void btnSubmit_click(object sender, EventArgs e)
{
    Tsn objTsn = new Tsn();
    string Result=objTsn.OrderRecieptSeq("D");
    lblRef.InnerText = Result;
    btnSubmit.Attributes.Add("onClick", "clntclick();");


}

【问题讨论】:

    标签: javascript c# jquery


    【解决方案1】:

    我认为这个过程行不通,您可能需要考虑使用注册启动脚本选项来显示您的弹出窗口/模式

    ClientScriptManager.RegisterClientScriptBlock

    protected void Button1_Click(object sender, EventArgs e)
    {        
        string script = "window.onload = function() { showpopup() };";
        ClientScript.RegisterStartupScript(this.GetType(), "showpopup", script, true);
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-24
      • 1970-01-01
      • 2018-01-06
      相关资源
      最近更新 更多