If I know just what the column is going to be called like "Model Number" is there a way that I can check if it exists?
Really, what I want to do is hide it if it exists. However, hiding it when it does not exists causes an exception. I want to avoid the exception.
e.Layout.Bands[0].Columns[
"Model Number"].Hidden = true;
You're looking for the Exists() method off the columns collection:
if (e.Layout.Bands[0].Columns.Exists("Model Number"))
This method returns true if a column with the given key exists in the columns collection, and false if not.
My two little cents... I try to not ever use hard coded strings when accessing column names because of the problems is causes since you won't find out you have a problem until run time. If using a datatable as the datasource I get the column name from the column object. I know that wasn't the question. I just feel pain when ever I see hard coded strings.