如何清除GridView的行和列 [英] How to clear gridview Rows and Columns
本文介绍了如何清除GridView的行和列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们
有没有一种方法可以在不删除gridview标头的情况下清除gridview行和列?
因为以下代码不起作用.
HI Guys
Is there a way to clear gridview rows and columns with out removing gridview header?
because following code dont work.
grvTravelClaims.DataSource = null;
grvTravelClaims.DataBind();
grvTravelClaims.Columns.Clear();
推荐答案
如果删除列,则删除标题-标题是这些列的标签.
相反,请尝试清除行:
If you remove the columns, then you remove the headers - the headers are the labels for the columns.
Instead, try clearing the rows:
grvTravelClaims.Rows.Clear();
这篇关于如何清除GridView的行和列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文