/// <summary>
        /// Creates a submit button for your form using an image
        /// </summary>
        /// <param name="helper">The helper which we extend.</param>
        /// <param name="name">Name of the button</param>
        /// <param name="imageSrc">The URL for the image</param>
        /// <param name="htmlAttributes">Dictionary of HTML settings</param>
        /// <returns></returns>
        public static MvcHtmlString SubmitImage(this HtmlHelper helper, string name, string imageSrc, IDictionary <string, object> htmlAttributes)
        {
            if (imageSrc == null)
            {
                throw new ArgumentNullException("imageSrc");
            }

            string resolvedUrl = UrlHelper.GenerateContentUrl(imageSrc, helper.ViewContext.HttpContext);

            return(MvcHtmlString.Create(ButtonBuilder.SubmitImage(name, resolvedUrl, htmlAttributes).ToString(TagRenderMode.SelfClosing)));
        }
Beispiel #2
0
        public static string SubmitImage(this HtmlHelper helper, string name, string imageSrc, IDictionary <string, object> htmlAttributes)
        {
            if (imageSrc == null)
            {
                throw new ArgumentNullException("imageSrc");
            }
            UrlHelper urlHelper   = new UrlHelper(helper.ViewContext.RequestContext); // TODO: Why do I need to do this?
            string    resolvedUrl = urlHelper.Content(imageSrc);

            return(ButtonBuilder.SubmitImage(name, resolvedUrl, htmlAttributes).ToString(TagRenderMode.SelfClosing));
        }
Beispiel #3
0
 public static MvcHtmlString SubmitButton(
     this HtmlHelper helper,
     string name,
     string buttonText,
     IDictionary <string, object> htmlAttributes
     )
 {
     return(MvcHtmlString.Create(
                ButtonBuilder
                .SubmitButton(name, buttonText, htmlAttributes)
                .ToString(TagRenderMode.SelfClosing)
                ));
 }
Beispiel #4
0
 public static MvcHtmlString Button(
     this HtmlHelper helper,
     string name,
     string buttonText,
     HtmlButtonType buttonType,
     string onClickMethod,
     IDictionary <string, object> htmlAttributes
     )
 {
     return(MvcHtmlString.Create(
                ButtonBuilder
                .Button(name, buttonText, buttonType, onClickMethod, htmlAttributes)
                .ToString(TagRenderMode.Normal)
                ));
 }