I've found the easiest way is after binding, check to see if there are no
records returned. If not, hide the DataGrid and show a Label that says,
"No records," or whatnot. If there are records, then do the opposite.
That is, you might have something like:
myDataGrid.DataSource = ...
myDataGrid.DataBind()
If myDataGrid.Items.Count = 0 then
'There are no records
myDataGrid.Visible = False
someLabelWithAMessage.Visible = True
Else
myDataGrid.Visible = True
someLabelWithAMessage.Visible = False
End If
Happy Programming!
--
Scott Mitchell
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com
* When you think ASP, think 4GuysFromRolla.com!
"Tony Farrell" <> wrote in message
news: om...
> Hi everyone,
>
> Using asp.net and a datagrid -
>
> When there are no records returned from
> the query - is there a way to add/insert
> a line into the grid stating there is/are
> no records to display???
>
> thanks
> tony