How do I perform an action on a gridview column only if it exists?
I have a gridview which is in a usercontrol on a page. The gridview displays data based on whatever the calling page tells it to, which may or may not include certain columns.
I want to tell the gridview how to format the columns if they're present on the page, but I also need it to ignore all the formatting if the column doesn't exist.. I already know how to format them, so I guess I just need a method to determine if they're there, and where they are in the 开发者_运维技巧gridview.
It sounds like you need to be creating everything dynamically in your code-behind to achieve this kind of granularity. This should help.
精彩评论