//public static MvcHtmlString ActionButton(this HtmlHelper htmlHelper, ButtonType buttonType, string buttonText, ButtonIcon buttonIcon, string actionName) //{ // var htmlStr = htmlHelper.ActionLink("REPLACE", actionName).ToHtmlString(); // return ActionButtonHTML.ActionButtonConstructor(buttonType, buttonText, buttonIcon, htmlStr); //} //public static MvcHtmlString ActionButton(this HtmlHelper htmlHelper, ButtonType buttonType, ButtonIcon buttonIcon, string actionName) //{ // return ActionButton(htmlHelper, buttonType, "", buttonIcon, actionName); //} public static MvcHtmlString ActionButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, string action, object htmlAttributes = null) { var htmlStr = string.Format("<a href='{0}'>REPLACE</a>", action); htmlStr = HTMLHelper.AddAttributesToHtmlElement(htmlStr, htmlAttributes); return(buttonParameters.ButtonConstructor(htmlStr)); }
public static MvcHtmlString ActionWindowButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, ActionParameters actionParameters, ActionButtonWindowParameters actionButtonWindowParameters) { var str = string.Format("<a id='{0}' href='#' class='actionWindow'>REPLACE</a>", actionButtonWindowParameters.Name); str = buttonParameters.ButtonConstructor(str).ToString(); str += WindowBuilderHelper.CreateWindow(htmlHelper, actionButtonWindowParameters, actionParameters); return(new MvcHtmlString(str)); }
public static MvcHtmlString FormCancelButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters) { var htmlStr = string.Format("<a>REPLACE</a>"); htmlStr = buttonParameters.ButtonConstructor(htmlStr).ToString(); htmlStr = HTMLHelper.AddClassToHtmlElement(htmlStr, "CloseIfInWindow"); htmlStr = HTMLHelper.AddClassToHtmlElement(htmlStr, "form-cancel"); return(new MvcHtmlString(htmlStr)); }
public static MvcHtmlString FormCloseButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, string functionToCall) { var htmlStr = string.Format("<a>REPLACE</a>"); htmlStr = buttonParameters.ButtonConstructor(htmlStr).ToString(); //htmlStr = HTMLHelper.AddClassToHtmlElement(htmlStr, "CloseIfInWindow"); htmlStr = HTMLHelper.AddClassToHtmlElement(htmlStr, "form-close"); htmlStr = HTMLHelper.AddAttributesToHtmlElement(htmlStr, string.Format("data-func='{0}'", functionToCall)); return(new MvcHtmlString(htmlStr)); }
public static MvcHtmlString ClientButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, string onClickFunction = "", string link = "#", string cssClasses = null, object htmlAttributes = null) { if (!string.IsNullOrEmpty(onClickFunction)) { if ((onClickFunction.LastIndexOf('(') > 0)) { if (onClickFunction[onClickFunction.LastIndexOf('(') + 1] == ')') { onClickFunction = onClickFunction.Substring(0, onClickFunction.LastIndexOf('(')) + "(caller)"; } } } var aLink = new TagBuilder("a"); if (!string.IsNullOrEmpty(onClickFunction)) { aLink.Attributes.Add("data-funcToCall", onClickFunction); aLink.Attributes.Add("onclick", "ClientButtonFunction(this)"); } if (!string.IsNullOrEmpty(link)) { aLink.Attributes.Add("href", link); } aLink.SetInnerText("REPLACE"); var htmlStr = aLink.ToString(); htmlStr = buttonParameters.ButtonConstructor(htmlStr).ToString(); htmlStr = !string.IsNullOrEmpty(cssClasses) ? HTMLHelper.AddClassToHtmlElement(htmlStr, cssClasses) : htmlStr; if (htmlAttributes != null) { htmlStr = ParseTupledAnonymousObject(htmlAttributes) .Aggregate(htmlStr, (current, prop) => HTMLHelper.AddAttributesToHtmlElement(current, string.Format("{0}='{1}'", prop.Key.Replace('_', '-'), prop.Value))); } return(new MvcHtmlString(htmlStr)); }
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 FormSubmitButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, string id = null) { var htmlStr = string.Format("<button id='{0}' type='submit'>REPLACE</button>", id); return(buttonParameters.ButtonConstructor(htmlStr)); }
public static MvcHtmlString ClientButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, ClientButtonFunctions clientButtonFunctions) { return(ClientButton(htmlHelper, buttonParameters, clientButtonFunctions.OnClickFunction, clientButtonFunctions.Link, clientButtonFunctions.CssClasses, clientButtonFunctions.HtmlAttributes)); }
//public static MvcHtmlString ClientButton(this HtmlHelper htmlHelper, ButtonType buttonType, string buttonText, ButtonIcon buttonIcon, string onClickFunction = "", string link = "#") //{ // return ClientButton(htmlHelper, new ButtonParameters(buttonIcon, buttonType, buttonText), onClickFunction, link); //} //public static MvcHtmlString ClientButton(this HtmlHelper htmlHelper, ButtonType buttonType, ButtonIcon buttonIcon, string onClickFunction = "", string link = "#") //{ // return ClientButton(htmlHelper, new ButtonParameters(buttonIcon, buttonType), onClickFunction, link); //} public static MvcHtmlString ClientButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, KnocktOutParameters knocktOutParameters) { return(ClientButton(htmlHelper, buttonParameters, new ClientButtonFunctions().HtmlAttributesSet(new { data_bind = knocktOutParameters.DataBindString }))); }
public static MvcHtmlString ActionDialogPromptButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, string action, string promptTitle, string onSuccessClientFunction = null) { return(ActionDialogFormButton(htmlHelper, buttonParameters, new ActionParameters(action), new ActionDialogFormParamters(promptTitle, null, action, null, onSuccessClientFunction))); }