【问题标题】:Pop Up Window Not Display弹出窗口不显示
【发布时间】:2014-12-16 10:04:55
【问题描述】:

为什么下面的代码无法在 html 源代码上注册?

page.ClientScript.RegisterStartupScript(page.GetType(), "Pop", pops);

下面是完整的代码。下面旨在显示弹出窗口。在其他页面上,弹出窗口正在使用同一行代码显示。我确定我的模态的ID 存在于HTML sn-p

public static void ShowModalDialog(Page page, string modalname = "myModal", int modalwidth = 560)
        {
            string pops = string.Empty;

                pops = "<script language='javascript'>" +
                             "$('#" + modalname + "').modal('toggle').css({ 'width': '" + modalwidth + "px', 'margin-left': function () { return -($(this).width() / 2); } });" +
                             "</script >";



            page.ClientScript.RegisterStartupScript(page.GetType(), "Pop", pops);
        }

【问题讨论】:

    标签: javascript c#-4.0 popup


    【解决方案1】:

    试试RegisterClientScriptBlock方法

    page.ClientScript.RegisterClientScriptBlock(page.GetType(), "Pop", pops);
    

    【讨论】:

      【解决方案2】:

      尝试更改您的代码

      Page.ClientScript.RegisterStartupScript(page.GetType(), "Pop", pops, true);
      

      【讨论】:

        【解决方案3】:

        检查启动脚本是否已经注册(IsStartupScriptRegistered)试试这个例子(你可以用你的语言得到它@msdn)msdn Example

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-10-12
          • 1970-01-01
          • 2022-12-14
          • 2020-08-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多