Пример #1
0
 /// <summary>
 ///   Adds the specified class or classes to the attributes.
 /// </summary>
 /// <param name = "attributes">The attributes to which to add classes.</param>
 /// <param name = "classes">The class or classes to be added.</param>
 /// <returns>The modified <see cref = "HtmlAttributes" /> instance.</returns>
 /// <remarks>
 ///   The classes are merged with the existing classes on the <see cref = "HtmlAttributes" /> instance.
 /// </remarks>
 public static HtmlAttributes Class(
     this HtmlAttributes attributes,
     string classes)
 {
     attributes.AddCssClass(classes);
     return(attributes);
 }
Пример #2
0
        /// <summary>
        /// Adds the specified class or classes to the attributes.
        /// </summary>
        /// <param name="attributes">The attributes to which to add classes.</param>
        /// <param name="classes">The class or classes to be added.</param>
        /// <param name="include">If set to <c>true</c>, add the class; otherwise, remove it.</param>
        /// <returns>
        /// The modified <see cref="HtmlAttributes"/> instance.
        /// </returns>
        /// <remarks>
        /// The classes are merged with the existing classes on the <see cref="HtmlAttributes"/> instance.
        /// </remarks>
        public static HtmlAttributes Class(
            this HtmlAttributes attributes,
            string classes,
            bool include)
        {
            if (include)
            {
                attributes.AddCssClass(classes);
            }
            else
            {
                attributes.RemoveCssClass(classes);
            }

            return(attributes);
        }