This project is read-only.

FieldContainer Attribute

[FieldContainer(typeof(CustomFieldsetTagBuilder))]
[Label(DoNotRender = true)]
public string Textbox{ get; set; }

public class CustomFieldsetTagBuilder : TagBuilder
{
     public CustomFieldsetTagBuilder() : base( "fieldset" )
     {
          var legend = new TagBuilder( "legend" );
          legend.SetInnerText( "Text Box with Custom Field Container!" );
          legend.Attributes.Add( "style", "padding-top:20px;" );
          this.InnerHtml = legend.ToString();
     }
}

Rendered Result:

<fieldset><legend style="padding-top:20px;">Text Box with Custom Field Container!</legend>
<input class="text-box single-line" id="TextBox" name="TextBox" type="text" value="" />
</fieldset>

If you are interested in overriding the default markup for all field containers please see the configuration page

Last edited Feb 21, 2011 at 5:10 AM by brk6004, version 11

Comments

No comments yet.