示例#1
0
        /// <summary>
        /// Render html element for specified field object.
        /// </summary>
        /// <param name="html">The html helper object.</param>
        /// <param name="field">The field object</param>
        /// <returns></returns>
        public static HelperResult Label(this HtmlHelper html, ContentField field)
        {
            return new HelperResult((w) =>
            {
                using (var writer = new Html32TextWriter(w))
                {
                    try
                    {
                        writer.WriteBeginTag("label");
                        writer.WriteAttribute("for", field.ClientID);
                        writer.Write(HtmlTextWriter.TagRightChar);
                        if (!string.IsNullOrEmpty(field.Title))
                            writer.WriteEncodedText(field.Title);
                        else
                            writer.WriteEncodedText(field.Name);
                        writer.WriteEndTag("label");
                    }
                    catch
                    {

                    }
                }
            });
        }
示例#2
0
 /// <summary>
 /// Render field description text for specified field object.
 /// </summary>
 /// <param name="html">The html helper object.</param>
 /// <param name="field">The field object.</param>
 /// <returns></returns>
 public static HelperResult Notes(this HtmlHelper html, ContentField field)
 {
     return new HelperResult((w) =>
     {
         using (var writer = new Html32TextWriter(w))
         {
             if (!string.IsNullOrEmpty(field.Description))
             {
                 writer.WriteBeginTag("small");
                 //writer.WriteAttribute("class", "d-field-notes d-notes");
                 writer.Write(HtmlTextWriter.TagRightChar);
                 writer.WriteEncodedText(field.Description);
                 writer.WriteEndTag("small");
             }
         }
     });
 }