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

  • 相关阅读:
    The Game
    棋盘问题(dfs)(类似8皇后)
    dfs---之全排列
    Dijkstra算法(求单源最短路径)
    四点共面 (简单题)
    最长递增子序列
    线段的重叠
    kruskal
    hdu 1232 畅通工程
    无限对拍程序
  • 原文地址:https://www.cnblogs.com/chucklu/p/10874335.html
Copyright © 2011-2022 走看看