开发者

How to make the datagrid with no data?

开发者 https://www.devze.com 2023-01-18 18:40 出处:网络
I have a page with two buttons: one is Load开发者_StackOverflow社区 Data and the other Clear 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

精彩评论

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

关注公众号