Exemplo n.º 1
0
        public static MvcHtmlString ActionDialogLink(this HtmlHelper htmlHelper, string linkText, ActionParameters actionParameters, ActionDialogFormParamters actionDialogFormParamters)
        {
            var tBuilder = new TagBuilder("a");

            tBuilder.SetInnerText(linkText);
            tBuilder.Attributes.Add("href", new UrlHelper(htmlHelper.ViewContext.RequestContext).Action(actionParameters.Action, actionParameters.Controller, actionParameters.RouteValues));
            tBuilder.Attributes.Add("data-dialog-title", actionDialogFormParamters.DialogTitle);
            tBuilder.Attributes.Add("data-update-target-id", actionDialogFormParamters.UpdateTargetId);
            tBuilder.Attributes.Add("data-update-url", actionDialogFormParamters.UpdateUrl);
            tBuilder.Attributes.Add("data-update-url-index", actionDialogFormParamters.UpdateUrlFormIndexFieldName);
            tBuilder.Attributes.Add("data-onSuccessfunction", actionDialogFormParamters.OnSuccessClientFunction);
            tBuilder.Attributes.Add("data-action", actionDialogFormParamters.Action);

            tBuilder.AddCssClass("dialogLink");


            return(new MvcHtmlString(tBuilder.ToString()));
        }
Exemplo n.º 2
0
        public static MvcHtmlString ActionDialogFormButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, ActionParameters actionParameters, ActionDialogFormParamters actionDialogFormParamters)
        {
            var tBuilder = new TagBuilder("a");

            tBuilder.SetInnerText("REPLACE");
            if (actionParameters.Action.Substring(0, 1) == "/")
            {
                tBuilder.Attributes.Add("href", actionParameters.Action);
            }
            else
            {
                tBuilder.Attributes.Add("href", new UrlHelper(htmlHelper.ViewContext.RequestContext).Action(actionParameters.Action, actionParameters.Controller, actionParameters.RouteValues));
            }

            tBuilder.Attributes.Add("data-dialog-title", actionDialogFormParamters.DialogTitle);
            tBuilder.Attributes.Add("data-update-target-id", actionDialogFormParamters.UpdateTargetId);
            tBuilder.Attributes.Add("data-update-url", actionDialogFormParamters.UpdateUrl);
            tBuilder.Attributes.Add("data-update-url-index", actionDialogFormParamters.UpdateUrlFormIndexFieldName);
            tBuilder.Attributes.Add("data-onSuccessfunction", actionDialogFormParamters.OnSuccessClientFunction);
            tBuilder.Attributes.Add("data-action", actionDialogFormParamters.Action);

            tBuilder.AddCssClass("dialogLink");

            var str = buttonParameters.ButtonConstructor(tBuilder.ToString()).ToString();

            return(new MvcHtmlString(str));
        }
        public static MvcHtmlString GridTopDialogForm(this HtmlHelper helper, ButtonParameters buttonParameters, ActionParameters actionParameters, ActionDialogFormParamters actionDialogFormParamters)
        {
            var fdButton   = helper.ActionDialogFormButton(buttonParameters, actionParameters, actionDialogFormParamters).ToString();
            var gridTopDiv = "<div class='t-toolbar t-grid-toolbar t-grid-top'>DIAGFORMBUTTON</div>";
            var comb       = gridTopDiv.Replace("DIAGFORMBUTTON", fdButton);

            return(new MvcHtmlString(comb));
        }