When no records in a DataGrid how to show a default alternative message?

R

Randall Parker

Title says it all. Using ASP.Net v1.1. Want to show some message when there are no
records to show in a grid. Does one do that with the DataGrid control itself? Or in
CodeBehind should one conditionally fill in a label control only when one tests and
sees the resultset of a query is empty?

How do you handle this case?
 
J

John Timney \( MVP \)

You could check the DataTable.Rows.Count to see if it carries values and not
display/bind the datagrid if it doesn't, or bind and hide the datagrid if
the DataGrid.Items.Count is zero. Of course any of those checks would allow
you to populate and show a conditional label with appropriate text.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top