[英]Check if a Column Exists in a RadGrid
這找不到列。 有人有什么建議嗎?
if (((RadGrid)sender).Columns.Contains("ClaimNumber"))
do this...
else
do this...
我檢查了網格的列集合,然后可以在其中看到該列。
您需要使用FindByUniqueNameSafe
方法:
GridColumn col = RadRadGrid1.MasterTableView.Columns.FindByUniqueNameSafe("ColumnName");
if (col != null)
{
//column exists
}
您還可以使用LINQ:
if (RadGrid1.MasterTableView.Columns.Cast<GridColumn>().Count(x => x.UniqueName == "Column1") > 0)
if (RadGridView.MasterView.ViewTemplate.Columns.Contains("Column")){ Exist}else{ Not-Exist}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.