dataGride and Declarative Parameters

Last post 07-23-2008 3:28 AM by amao. 3 replies.

Sort Posts:

  • dataGride and Declarative Parameters

    07-01-2008, 2:46 AM
    • Member
      53 point Member
    • amao
    • Member since 09-11-2007, 3:23 AM
    • Posts 126

     Hi all I am using Gridview get data from TextBox (http://www.asp.net/learn/data-access/tutorial-05-cs.aspx)

    in case there are no data I need to show MSG to the user "no data found "

    Plz help
     

  • Re: dataGride and Declarative Parameters

    07-01-2008, 4:35 AM
    Answer
    • Star
      7,995 point Star
    • MelvynHarbour
    • Member since 06-06-2008, 9:33 AM
    • Cambridge, UK
    • Posts 1,288

    You just need to set the EmptyDataText property of the GridView to be your text. It will then get shown automatically if there is no data returned.

  • Re: dataGride and Declarative Parameters

    07-01-2008, 7:54 AM
    Answer
    • Contributor
      5,709 point Contributor
    • Pushkar
    • Member since 02-17-2006, 7:27 AM
    • Vibrant Gujarat
    • Posts 1,085

    Another way is...

    Take on Lable outside of the GridView & make it visible false.. 

    If u bind the GridView with DS then check the number row count in the dataset..

    Like dsRecords.

    if(dsRecords.Table[0].Rows.Count > 0)

    {

        //Bind GridView 

    else

    {

        lblNoRecord.Text = "No records found."; 

        lblNoRecord.Visible = true;

        GridView1.Visible = false;

    “ There is no great genius without some touch of madness. ”


    Remember to click “Mark as Answer” on the post If you get answer from my post(s) !

    Thanks Guys
    ------------
    Pushkar M Rathod
  • Re: dataGride and Declarative Parameters

    07-23-2008, 3:28 AM
    • Member
      53 point Member
    • amao
    • Member since 09-11-2007, 3:23 AM
    • Posts 126

    thank you very much

Page 1 of 1 (4 items)