ASP.NET- Repeater control. Check for number of rows!!?

Discussion in 'Digital Media' started by Basheer A, Apr 20, 2008.

  1. Basheer A Guest

    Basheer A
    Hi Gurus

    In my Asp.net page I use a Repeater contol to display data read from an access database using SQL qurey. I do this using an Oledb connection using the following lines of code.

    MyRepeater.DataSource = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

    MyRepeater.DataBind()

    The problem is; if the query returns no matching records, I want to display an info messsage to the user. How can I do it ?Or How can I check wheather myRepeater is empty??

    Regards.
  2. Mark B Guest

    Mark B
    Try this:

    if (Repeater1.Items.Count == 0)
    Label1.Text = "Empty";

    You can also check out the website www.asp.net, it's a great resource for .NET web developers

Share This Page