Yours declaratively, GridView
Any ASP.NET developer will agree that the GridView control is like a DataGrid on steroids. Complex functionality can be achieved by setting GridView properties declaratively instead of writing complex code as in the DataGrid days.
There are 2 thoughtful properties that handle the case when the data source has no rows to bind or when a particular row has an empty field.
GridView.EmptyDataText property can be used to set the text to render in the GridView when bound to an empty data source.
GridView's column field type BoundField has a NullDisplayText property which can be used to assign an alternative text value when a bound field's value is null.
(Code formatted with CSAH)
There are 2 thoughtful properties that handle the case when the data source has no rows to bind or when a particular row has an empty field.
GridView.EmptyDataText property can be used to set the text to render in the GridView when bound to an empty data source.
GridView's column field type BoundField has a NullDisplayText property which can be used to assign an alternative text value when a bound field's value is null.
<asp:GridView ID="GridView1" ..
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField .. NullDisplayText="n/a"/> ..
(Code formatted with CSAH)
Comments
Post a Comment