GridView ASP.NET 2.0 Question

Discussion in 'ASP .Net' started by dm1608, Feb 17, 2006.

  1. dm1608

    dm1608 Guest

    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
     
    dm1608, Feb 17, 2006
    #1
    1. Advertising

  2. dm1608

    Brock Allen Guest

    The GridView has an EmptyDataTemplate for when there are no rows.

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


    > 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
    >
     
    Brock Allen, Feb 17, 2006
    #2
    1. Advertising

  3. dm1608

    Ram Guest

    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
     
    Ram, Feb 18, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Smith jr.

    Data Access with GridView [ASP.Net 2.0] question

    Robert Smith jr., Nov 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,155
    Angelo Cook
    Nov 8, 2005
  2. =?Utf-8?B?SmFmZmE=?=

    ASP .NET 2.0 GridView Question

    =?Utf-8?B?SmFmZmE=?=, Jan 20, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    9,710
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Jan 20, 2006
  3. Bishop

    ASP.NET Dynamic Gridview Question

    Bishop, Mar 23, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    17,270
    Bishop
    Mar 24, 2006
  4. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    18,022
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  5. Cirene
    Replies:
    1
    Views:
    384
    gnewsgroup
    Nov 4, 2007
Loading...

Share This Page