public static IHtmlElement Image(this IBuilder builder, Uri source, string alternativeDescription = null, HtmlAttributes attributes = null) { var newAttributes = attributes ?? new HtmlAttributes(); newAttributes.Add("src", source.ToString()); newAttributes.Add("alt", alternativeDescription ?? String.Empty); return ImageElement(builder, newAttributes); }
/// <summary> /// The <c><a></c> tag defines a hyperlink, which is used to link from one page to another. <remarks></remarks> /// The most important attribute of the <c><a></c> element is the href attribute, which indicates the link's destination. <remarks></remarks> /// By default, links will appear as follows in all browsers: <remarks></remarks>‌	‌	‌	 /// • An unvisited link is underlined and blue <remarks></remarks>‌	‌	‌	 /// • A visited link is underlined and purple <remarks></remarks>‌	‌	‌	 /// • An active link is underlined and red <remarks> </remarks> /// /// For more information see: <see cref="http://www.w3schools.com/tags/tag_a.asp"/> /// </summary> /// <param name="builder">Builder for the Html Component</param> /// <param name="address">The URI where the HyperLink should refer to<c> [href]</c></param> /// <param name="target">The window target<c> [target="_blank | _parent | _self | _top | <frameName>"]</c> (optional)</param> /// <param name="attributes">Standard HTML Attributes (optional)</param> /// <returns></returns> public static IHtmlElement HyperLink(this IBuilder builder, Uri address, HyperLinkTarget target = null, HtmlAttributes attributes = null) { var newAttributes = attributes ?? new HtmlAttributes(); newAttributes.Add("href", address.ToString()); if(target != null) newAttributes.Add("target", target.ToString()); return builder.Anchor(newAttributes); }
/// <summary> /// The <c><button></c> tag defines a clickable button.<remarks></remarks> /// Inside a <c><button></c> element you can put content, like text or images. <remarks></remarks> /// This is the difference between this element and buttons created with the <c><input></c> element. <remarks></remarks> /// Tip: Always specify the type attribute for a <c><button></c> element. Different browsers use different default types for the <c><button></c> element. <remarks> </remarks> /// /// For more information see: <see cref="http://www.w3schools.com/tags/tag_button.asp"/> /// </summary> /// <param name="builder">Builder for the Html Component</param> /// <param name="value">The text value of the button</param> /// <param name="name">Specifies a name for the button<c> [name]</c> (optional)</param> /// <param name="type"> /// Specifies the type of button<c> [type="button | submit | reset "]</c> (optional) <remarks></remarks> /// If left blank, it will default to <see cref="InputType.ButtonTypes.Button"/> /// </param> /// <param name="formTarget">The window target<c> [target="_blank | _parent | _self | _top | <frameName>"]</c> (optional)</param> /// <param name="attributes">Standard HTML Attributes (optional)</param> /// <returns></returns> public static IHtmlElement Button(this IBuilder builder, string value, string name = null, FormButtonType type = null, HyperLinkTarget formTarget = null, HtmlAttributes attributes = null) { var newAttributes = attributes ?? new HtmlAttributes(); if(!String.IsNullOrWhiteSpace(name)) newAttributes.Add("name", name); newAttributes.Add("type", (type ?? InputType.ButtonTypes.Button).ToString()); if(formTarget != null) newAttributes.Add("formTarget", formTarget.ToString()); return ButtonElement(builder, newAttributes).SetText(value); }