I'm implementing a Gridview that can accept several different sets of results depending on the query. It's the front end for an electronic component database, and different columns will be used to display information on resistors, capacitors, etc. My intent was to hide all of the columns with data on components that weren't part of the query, and that I can do. However, it the query returns, for instance, data about resistors, then I get an error from the first column devoted to non-resistor data. The error message says that the field wasn't found. That makes sense, since the query didn't retrieve data from those other tables, and the fields don't exist in the Gridview's datasource. My question is, how can I prevent the "field not found" error? What I would like is a way to conditionally disable or remove the columns not related to my query, or handle the error so that the Gridview will display, with only the relevant columns visible. Any thoughts?
-Chris