Beispiel #1
0
        public static IDisposable Dialog(this HtmlHelper htmlHelper, DialogSetting set = null)
        {
            HtmlDialog dialog = new HtmlDialog(htmlHelper.ViewContext, set);

            dialog.BeginDialog();
            return(dialog);
        }
Beispiel #2
0
        public HtmlDialog(ViewContext viewContext, DialogSetting set)
        {
            if (viewContext == null)
            {
                throw new ArgumentNullException("viewContext");
            }

            if (set == null)
            {
                set = DialogSetting.DefaultSetting;
            }

            this._viewContext = viewContext;
            this._set         = set;
        }
Beispiel #3
0
        public static HtmlString BeginDialog(this HtmlHelper htmlHelper, DialogSetting set = null)
        {
            StringBuilder htmlBuilder = new StringBuilder();

            if (set == null)
            {
                set = DialogSetting.DefaultSetting;
            }

            htmlBuilder.CAppend("<div data-bind=\"with:{0}\">", set.WithModel).AppendLine();
            htmlBuilder.CAppend("    <div data-bind=\"display:IsShow()\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\" id=\"{0}\" data-backdrop=\"false\" data-keyboard=\"true\">", set.Id).AppendLine();
            htmlBuilder.CAppend("        <div class=\"modal-dialog\" style=\"width:{0}px;\">", set.Width.ToString()).AppendLine();
            htmlBuilder.CAppend("            <div class=\"modal-content\" style=\"width:{0}px;\">", set.Width.ToString()).AppendLine();

            /* header */
            htmlBuilder.CAppend("                <div class=\"modal-header\">").AppendLine();
            htmlBuilder.CAppend("                    <label data-bind=\"text:Title\"></label>").AppendLine();
            htmlBuilder.CAppend("                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\" data-bind=\"click:function(){ IsShow(false);}\"><span aria-hidden=\"true\">&times;</span></button>").AppendLine();
            htmlBuilder.CAppend("                </div>").AppendLine();

            return(new HtmlString(htmlBuilder.ToString()));
        }
Beispiel #4
0
        public static HtmlString BeginDialog(this HtmlHelper htmlHelper, string withModel, string id, int width)
        {
            DialogSetting set = new DialogSetting(withModel, id, width);

            return(BeginDialog(htmlHelper, set));
        }
Beispiel #5
0
        public static IDisposable Dialog(this HtmlHelper htmlHelper, string withModel, string id, int width)
        {
            DialogSetting set = new DialogSetting(withModel, id, width);

            return(Dialog(htmlHelper, set));
        }
Beispiel #6
0
        public static IDisposable Dialog(this HtmlHelper htmlHelper, int width)
        {
            DialogSetting set = new DialogSetting(width);

            return(Dialog(htmlHelper, set));
        }