private static MvcHtmlString LocalizedButton(string type, ButtonAttributes attributes) { TagBuilder tagBuilder = new TagBuilder("button"); // build the input tag. if (!string.IsNullOrWhiteSpace(type)) { tagBuilder.MergeAttribute("type", type); } if (!string.IsNullOrWhiteSpace(attributes.Id)) { tagBuilder.MergeAttribute("id", attributes.Id); } if (!string.IsNullOrWhiteSpace(attributes.DefaultCssClass)) { tagBuilder.MergeAttribute("class", attributes.DefaultCssClass); } if (!string.IsNullOrWhiteSpace(attributes.CssClass)) { //tagBuilder.MergeAttribute("class", attributes.CssClass); tagBuilder.AddCssClass(attributes.CssClass); } tagBuilder.InnerHtml = !string.IsNullOrWhiteSpace(attributes.ResourceKey) ? ResourceManager.GetString(attributes.ResourceKey) : string.Empty; if (!string.IsNullOrWhiteSpace(attributes.OnClick)) { tagBuilder.MergeAttribute("onclick", attributes.OnClick); } return(MvcHtmlString.Create(tagBuilder.ToString(TagRenderMode.Normal))); }
public static MvcHtmlString LocalizedCancel(this HtmlHelper helper, String type, ButtonAttributes attributes) { attributes.DefaultCssClass = "btn btn-info"; attributes.ResourceKey = "Shared.Buttons.Cancel"; return(LocalizedButton(type, attributes)); }
public static MvcHtmlString LocalizedSaveNext(this HtmlHelper helper, String type, ButtonAttributes attributes) { attributes.ResourceKey = "Shared.Buttons.SaveNext"; return(LocalizedSubmitButton(helper, type, attributes)); }
public static MvcHtmlString LocalizedSubmitButton(this HtmlHelper helper, String type, ButtonAttributes attributes) { attributes.DefaultCssClass = "btn btn-info"; return(LocalizedButton(type, attributes)); }