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

Discussion in 'ASP .Net' started by Randall Parker, Nov 9, 2005.

  1. 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?
    Randall Parker, Nov 9, 2005
    #1
    1. Advertising

  2. 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

    "Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit.com>
    wrote in message news:...
    > 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?
    John Timney \( MVP \), Nov 9, 2005
    #2
    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. Tom Kaminski [MVP]

    Use a single DataGrid to show Master/Detail records?

    Tom Kaminski [MVP], Nov 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    487
    Tom Kaminski [MVP]
    Nov 10, 2003
  2. =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=

    RE: Datagrid wont display records by default

    =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=, May 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    402
    =?Utf-8?B?TW8=?=
    May 10, 2004
  3. Luke Airig
    Replies:
    0
    Views:
    765
    Luke Airig
    Dec 31, 2003
  4. RN1
    Replies:
    1
    Views:
    303
    Robert Dunlop
    Oct 21, 2008
  5. Dan

    Delete records or update records

    Dan, May 10, 2004, in forum: ASP General
    Replies:
    1
    Views:
    449
    Ray at
    May 10, 2004
Loading...

Share This Page