Beispiel #1
0
        public static TagBuilder Button(string name, string buttonText, HtmlButtonType type, string onClickMethod, IDictionary <string, object> htmlAttributes)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            TagBuilder buttonTag = new TagBuilder("button");

            if (!String.IsNullOrEmpty(name))
            {
                buttonTag.MergeAttribute("name", name);
            }

            buttonTag.MergeAttribute("type", type.ToString().ToLowerInvariant());

            buttonTag.InnerHtml = buttonText;

            if (!String.IsNullOrEmpty(onClickMethod))
            {
                buttonTag.MergeAttribute("onclick", onClickMethod);
            }

            buttonTag.MergeAttributes(htmlAttributes, true);
            return(buttonTag);
        }
        public static TagBuilder Button(string name, string buttonText, HtmlButtonType type, string onClickMethod, IDictionary<string, object> htmlAttributes)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            TagBuilder buttonTag = new TagBuilder("button");

            if (!String.IsNullOrEmpty(name))
            {
                buttonTag.MergeAttribute("name", name);
            }

            buttonTag.MergeAttribute("type", type.ToString().ToLowerInvariant());

            buttonTag.InnerHtml = buttonText;

            if (!String.IsNullOrEmpty(onClickMethod))
            {
                buttonTag.MergeAttribute("onclick", onClickMethod);
            }

            buttonTag.MergeAttributes(htmlAttributes, true);
            return buttonTag;
        }
Beispiel #3
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)
                ));
 }
Beispiel #4
0
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="helper">The helper which we extend.</param>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <returns></returns>
 public static MvcHtmlString Button(
     this HtmlHelper helper,
     string name,
     string buttonText,
     HtmlButtonType buttonType
     )
 {
     return(helper.Button(
                name,
                buttonText,
                buttonType,
                null,
                (IDictionary <string, object>)null
                ));
 }
Beispiel #5
0
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="helper">The helper which we extend.</param>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static MvcHtmlString Button(
     this HtmlHelper helper,
     string name,
     string buttonText,
     HtmlButtonType buttonType,
     string onClickMethod,
     object htmlAttributes
     )
 {
     return(helper.Button(
                name,
                buttonText,
                buttonType,
                onClickMethod,
                HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)
                ));
 }
 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));
 }
 public static MvcHtmlString Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod, object htmlAttributes) {
     return helper.Button(name, buttonText, buttonType, onClickMethod, new RouteValueDictionary(htmlAttributes));
 }
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod) {
     return helper.Button(name, buttonText, buttonType, onClickMethod, (IDictionary<string, object>)null);
 }
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="helper">The helper which we extend.</param>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod, object htmlAttributes)
 {
     return helper.Button(name, buttonText, buttonType, onClickMethod, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
Beispiel #10
0
 public static string Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod, object htmlAttributes)
 {
     return(helper.Button(name, buttonText, buttonType, onClickMethod, new RouteValueDictionary(htmlAttributes)));
 }
Beispiel #11
0
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static string Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod)
 {
     return(helper.Button(name, buttonText, buttonType, onClickMethod, (IDictionary <string, object>)null));
 }
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static string Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType) {
     return helper.Button(name, buttonText, buttonType, null, (IDictionary<string, object>)null);
 }