zoukankan      html  css  js  c++  java
  • webform将一个usercontrol作为模态框在page上弹出

    弹窗

    public static void RegisterJQueryDialogScript(Page page, string dialogDivId, string title, int width, int height, bool autoOpen, string openTriggerClientId)
            {
                if (string.IsNullOrEmpty(title))
                    title = "Form";
    
                var heightStr = string.Empty;
                var witdthStr = string.Empty;
                if (height > 0)
                    heightStr = "height: " + height.ToString() + ",";
                if (width > 0)
                    witdthStr = " " + width.ToString() + ",";
    
                string script = @"
    $(function ()
    {
        $('#dialog:ui-dialog').dialog('destroy');
        $('#" + dialogDivId + @"').dialog(
            {
                title: '" + title + @"',
                autoOpen:" + autoOpen.ToString().ToLower() + "," +
                heightStr +
                witdthStr + @"
                closeText: 'No',
                modal: true,
                resizable: false
            }
        ).parent().appendTo('form');
    }
    );
    ";
                string scriptKey = "Open" + dialogDivId;
                if (autoOpen)
                    ScriptManager.RegisterStartupScript(page, page.GetType(), scriptKey, script, true);
                else
                {
                    ScriptManager.RegisterClientScriptBlock(page, page.GetType(), scriptKey, script, true);
    
                    var scriptTrigger = @"$('#" + openTriggerClientId + @"')
                            .click(function () {
                                $('#" + dialogDivId + @"').dialog('open');
                                return false;
                            });";
                    scriptKey += "Trigger";
                    ScriptManager.RegisterStartupScript(page, page.GetType(), scriptKey, scriptTrigger, true);
                }
            }

    Open a user control in a pop up

  • 相关阅读:
    Roads in the North
    Labyrinth
    英语写作(二)
    语法长难句笔记
    英语写作(一)
    MySQL笔记(二)
    MySQL笔记(一)
    Mybatis简单使用与配置
    Mybatis映射文件
    什么是serializable接口?
  • 原文地址:https://www.cnblogs.com/chucklu/p/10874335.html
Copyright © 2011-2022 走看看