Hi,
I use a dynamically created RadGrid which means the column unique names are not always the same. I perform some data modification on ItemDataBound based on a columns unique name which works as expected if the column exists.
Of course, if the column does not exist I get an error alert "Cannot find a cell bound to column name 'coltrainerList'". I expected this also - but I am unsure of how to determine if it exists or not. I tried the following:
Unfortunately, I still get the error alert. I have looked through the GridDataItem functions and not found one that can check if a unique column name exists in order to avoid this error.
Have I missed something?
Cheers.
I use a dynamically created RadGrid which means the column unique names are not always the same. I perform some data modification on ItemDataBound based on a columns unique name which works as expected if the column exists.
protected void grvReport_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem item = ((GridDataItem)e.Item); |
item["coltrainerList"].Text = item["coltrainerList"].Text.Replace(",", "<br/>"); |
} |
// Other unrelated stuff |
} |
Of course, if the column does not exist I get an error alert "Cannot find a cell bound to column name 'coltrainerList'". I expected this also - but I am unsure of how to determine if it exists or not. I tried the following:
if (item["coltrainerList"] != null) item["coltrainerList"].Text = item["coltrainerList"].Text.Replace(",", "<br/>"); |
Unfortunately, I still get the error alert. I have looked through the GridDataItem functions and not found one that can check if a unique column name exists in order to avoid this error.
Have I missed something?
Cheers.