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.


<asp:GridView ID="GridView1" ..

EmptyDataText="There are no data records to display.">


<Columns>


<asp:BoundField .. NullDisplayText="n/a"/> ..




(Code formatted with CSAH)

Comments

Popular posts from this blog

Maven Crash Course - Learn Power Query, Power Pivot & DAX in 15 Minutes

"Data Prep & Exploratory Data Analysis" course by Maven Analytics

Oracle Cloud Infrastructure 2024 Generative AI Professional Course & Certification Exam (1Z0-1127-24)