开发者

How to make the datagrid with no data?

I have a page with two buttons: one is Load开发者_StackOverflow社区 Data and the other Clear Data.

I am using DataSet and have used ds.Tables.Clear() in that click code.

If the user clicks Clear Data will the data in the datagrid disappear or not?


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();


According to your comment, the answer is No.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜