asp.net.ph

Skip Navigation Links

Specifying Row Format in a FormView Control

Controls You Can Use on Web Forms   ASP.NET Data Controls   FormView Control


The FormView Web server control includes properties for customizing the format of items in the control. Formatting is applied in the order listed below:

  • styles that apply to the FormView control as a whole
  • styles that apply to each row or template type
  • styles that apply to elements within templates

To set the format for the FormView as a whole

  • Set the properties within the opening tag of the FormView control.
    <asp:formview id="formView" runat="server"
       width="90%"
       cellpadding=5
       font-size="9pt"
       ... />

To set the format for individual row or template types

  • Set the properties within the opening tag of the appropriate Style object in the FormView.
    <asp:formview id="formView" runat="server"
       cellpadding=5
       font-size="9pt">
    
       <headerstyle backcolor="maroon"
          forecolor="khaki" />
    
       <rowstyle backcolor="khaki"
          borderstyle="outset"
          borderwidth="1px"
          horizontalalign="center" />
    
       <insertrowstyle backcolor="lightgreen"
          borderstyle="inset"
          borderwidth="1px"
          horizontalalign="center" />
    
    </asp:formview>

To set the format for individual elements within templates

  • Set the properties within the opening tag of the element or control.
    <edititemtemplate>
    
       <asp:radiobuttonlist runat="server"
          backcolor="khaki"
          forecolor="navy"
          ... >
          ...
       </asp:radiobuttonlist>
    
    </edititemtemplate>

Changing the style settings for individual elements override the settings made for the row types and for the entire control.

Style properties can also be set programmatically. For more information, see FormView in the class library.

See Also

Adding FormView Controls to a Web Forms Page   Specifying Paging Behavior in a FormView Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note