Displaying Message When DataGrid is empty

G

Guest

I need to Display DataGrid Headers and the "no records" message when the
DataGrid is empty, is there any way to achieve this.

Thank you
 
G

Guest

You can use

if (datagrid.Items.Count == 0)
{
Page.RegisterStartupScript("message", "<script>alert('no
records')</script>")
}

to show the message.

HTH

Elton Wang
(e-mail address removed)
 
S

Steve C. Orr [MVP, MCSD]

Something along these lines should do the trick:

If MyDataSet.Tables(0).Rows.Count=0 then
lblNoRecords.Visible=True
Else
MyDataGrid.Visible=True
End If
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top