tags:

views:

15

answers:

1

hi everyone,

How to make the datagrid with no data when a user click's the button.I have a page with 2 buttons one is Load Data and Clear Data.If the user click's the CLick button will the data in the datagrid will disppear or not?Am using DataSet.

I have used ds.Tables.Clear() in that Click code .Please help me

A: 

For showing grid with no rows, check GridView.EmptyDataTemplate Property

or

You can create an empty row and add to your datagrid like this -

if(datatable.Rows.Count == 0)
{
    datatable.Rows.Add(datatable.NewRow);
}
datagrid.DataSource = datatable;
datagrid.DataBind();
Sachin Shanbhag