Example #1
0
        /// <summary>
        /// Returns a string of HTML attributes with the specified values.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
        /// <param name="htmlAttributes">A dictionary that contains the HTML attributes to set for the element.</param>
        /// <returns>A string of HTML attributes with the specified values.</returns>
        public static MvcHtmlString Attributes( this HtmlHelper htmlHelper, IDictionary<string, object> htmlAttributes )
        {
            if( htmlAttributes == null )
            {
                return MvcHtmlString.Empty;
            }

            return MvcHtmlString.Create( htmlAttributes.ToHtmlAttributeString() );
        }