Home All Groups Group Topic Archive Search About
Author
17 Feb 2006 10:46 PM
dm1608
Hi, I'm using a GridView and an ObjectDataSource to display data.

How can I display a "No records found" message if there are no query
results?

Currently, I'm getting a blank page since the GridView has nothing to
display.

Thanks

Author
17 Feb 2006 10:56 PM
Brock Allen
The GridView has an EmptyDataTemplate for when there are no rows.

-Brock
http://staff.develop.com/ballen


Show quoteHide quote
> Hi, I'm using a GridView and an ObjectDataSource to display data.
>
> How can I display a "No records found" message if there are no query
> results?
>
> Currently, I'm getting a blank page since the GridView has nothing to
> display.
>
> Thanks
>
Author
18 Feb 2006 9:35 AM
Ram
Hi,

  Use the "EmptyDataText property" of the grid view.

Ex:
<asp:GridView  ID="GridView1" EmptyDataText="No timesheets entered."
EmptyDataRowStyle-CssClass ="EmptyText" runat="server"
AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" DataSourceID="SqlDataSource1">

Thanks and Regards,
S.Ramalingam