asp.net.ph

GridView.EmptyDataRowStyle Property

System.Web.UI.WebControls Namespace   GridView Class


.NET Framework version 2.0

Sets or retrieves the style properties of an empty data row when the data source bound to a GridView control returns empty, or contains no data.

Syntax


Script GridView.EmptyDataRowStyle.Property [ = enumValue ]

Property Value

A TableItemStyle object that defines the style properties for an empty data row in a GridView.

Remarks

Use this property to provide a custom style for an empty data row in a GridView control. Common style attributes that can be set include forecolor, backcolor, font, and content alignment within the cell. Providing different row styles enhances the appearance of the GridView control.

The EmptyDataRowStyle subproperties can be set declaratively using either of the following methods:

  • Include an attribute in the opening tag of the GridView control in the form EmptyDataRowStyle-Property
    <asp:gridview ... 
       emptydatarowstyle-property=value
       ... >
    
    </asp:gridview>
  • Include an <EmptyDataRowStyle> element between the opening and closing tags of the GridView control
    <asp:gridview ... >
    
       <emptydatarowstyle
          ... property definitions here />
    
    </asp:gridview>

The subproperties can also be set programmatically in the form EmptyDataRowStyle.Property.

For a list of style properties that can be set, see the TableItemStyle class.

Example

The below snippet shows how to set the EmptyDataRowStyle for a GridView control at design time.

<asp:gridview id = "msgView" runat = "server" ... >

   <headerstyle backcolor = "steelblue"
      forecolor = "beige" />

   <rowstyle verticalalign = "top" />

   <emptydatarowstyle backcolor = "lightgreen" />

   <itemtemplate>
      ...
   </itemtemplate>

</asp:gridview>
See Also

EditRowStyle   InsertRowStyle   RowStyle Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph