Пример #1
0
        public static IHtmlContent RAToolbarShowDialogButton(
            this IHtmlHelper htmlHelper,
            string buttonText,
            string contentUrl,
            string returnUrl             = null,
            object htmlAttributes        = null,
            string dialogTitle           = null,
            bool showActionButton        = true,
            string actionButtonCaption   = "Save",
            bool showCancelButton        = true,
            string cancelButtonCaption   = "Cancel",
            string buttonClass           = "btn-secondary",
            string buttonStyle           = null,
            RAModalDialogSize dialogSize = RAModalDialogSize.Medium)
        {
            var attributes = HtmlHelperHelper.ToAttributesDictionary(htmlAttributes);

            attributes.AddToolbarButtonAttributes();

            return(htmlHelper.RAShowModalDialogButton(
                       buttonText,
                       contentUrl,
                       returnUrl,
                       attributes,
                       dialogTitle,
                       showActionButton,
                       actionButtonCaption,
                       showCancelButton,
                       cancelButtonCaption,
                       buttonClass,
                       buttonStyle,
                       dialogSize));
        }
        public static IHtmlContent RAShowDialogLink(
            this IHtmlHelper htmlHelper,
            string linkText,
            string contentUrl,
            string returnAction          = null,
            object htmlAttributes        = null,
            string dialogTitle           = null,
            bool showActionButton        = true,
            string actionButtonCaption   = "Save",
            bool showCancelButton        = true,
            string cancelButtonCaption   = "Cancel",
            RAModalDialogSize dialogSize = RAModalDialogSize.Medium)
        {
            var attributes = HtmlHelperHelper.ToAttributesDictionary(htmlAttributes);

            attributes.AddOrInsertToExisting("class", "ra-clickable");
            attributes.Add("href", "#");
            attributes.Add("onmouseup", htmlHelper.RAShowModalDialogScript(contentUrl, returnAction, dialogTitle ?? linkText,
                                                                           showActionButton, actionButtonCaption, showCancelButton, cancelButtonCaption, dialogSize));

            var tagBuilder = new TagBuilder("a")
            {
                TagRenderMode = TagRenderMode.Normal
            };

            tagBuilder.MergeAttributes(attributes);
            tagBuilder.InnerHtml.AppendHtml(linkText);

            return(tagBuilder);
        }
 public static string RAShowModalDialogScript(
     this IHtmlHelper htmlHelper,
     string contentUrl,
     string returnAction,
     string dialogTitle,
     bool showActionButton        = true,
     string actionButtonCaption   = "Save",
     bool showCancelButton        = true,
     string cancelButtonCaption   = "Cancel",
     RAModalDialogSize dialogSize = RAModalDialogSize.Medium)
 {
     return(String.Format("raShowModalDialog('{0}', '{1}', '{2}', {3}, '{4}', {5}, '{6}', '{7}', this);",
                          contentUrl,
                          returnAction,
                          dialogTitle,
                          showActionButton.ToString().ToLower(),
                          actionButtonCaption,
                          showCancelButton.ToString().ToLower(),
                          cancelButtonCaption,
                          dialogSize.ToString().ToLower()));
 }
        public static IHtmlContent RAShowModalDialogButton(
            this IHtmlHelper htmlHelper,
            string buttonHtml,
            string contentUrl,
            string returnAction          = null,
            object htmlAttributes        = null,
            string dialogTitle           = null,
            bool showActionButton        = true,
            string actionButtonCaption   = "Save",
            bool showCancelButton        = true,
            string cancelButtonCaption   = "Cancel",
            string buttonClass           = "btn-secondary",
            string buttonStyle           = null,
            RAModalDialogSize dialogSize = RAModalDialogSize.Medium)
        {
            var attributes = HtmlHelperHelper.ToAttributesDictionary(htmlAttributes);

            attributes.AddButtonAttributes(buttonClass, buttonStyle);
            attributes.Add("onmouseup", htmlHelper.RAShowModalDialogScript(contentUrl, returnAction, dialogTitle ?? buttonHtml,
                                                                           showActionButton, actionButtonCaption, showCancelButton, cancelButtonCaption, dialogSize));

            return(attributes.ToButton(buttonHtml));
        }