ap .net : gridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishalgupta
    New Member
    • Jun 2007
    • 47

    #1

    ap .net : gridview

    i display record in a gridview using a sqldatasource control using a custom sql statement.

    sometimes there is no record returned by the custom sql statement and so the gridview is empty and so there is nothing displayed on the screen.

    how can i display the message "No results found" when the gridview is empty?
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    Originally posted by vishalgupta
    i display record in a gridview using a sqldatasource control using a custom sql statement.

    sometimes there is no record returned by the custom sql statement and so the gridview is empty and so there is nothing displayed on the screen.

    how can i display the message "No results found" when the gridview is empty?
    are you using any dataset or datareader..... ???

    check for
    ds.Tables[0].rows.count for number fo records......

    Comment

    • krille
      New Member
      • Feb 2008
      • 26

      #3
      actually the gridview has a property for this and its named EmptyDataText.S o all you need to do is use that property.

      <asp:GridView ID="MyGrid" EmptyDataText=" No records found" ......

      This is nice to use when you populate a GridView with an search result.

      Good Luck
      /Krille

      Comment

      Working...