I need to use a custom class which returns a generic.list object. I can make it the datasource and get it to display great. I would like to manipulate the columns (add, hide, etc) at runtime. I seem to either be putting the wrong keywords in the search or something. FYI, I am a nubee to Infragistics toolset.
You could use an UltraDataSource, as Alex suggests. But there's nothing wrong with a generic list of objects. Just be aware that a List is not a really robust interface and it's not reall intended for data binding. The DotNet BindingManager won't be able to add new items to a List, so you won't be able to use the AddNew row in the grid. Nor will it send notifications to the grid when values in the list change in code - not through the grid. The UltraDataSource would solve all of these problems for you. Another option would be to use a generic BindingList instead of a List.
Either way, you can add unbound columns to the grid usng the add method on the Band. And you can also hide columns using the Hidden property (as Alex mentions above).
One thing I would recommend, though, is that you use the InitializeLayout event for all of this. The event fires any time the grid's DataSource changes, so it's designed to allow you to set up your layout.
Hi Mike,
I am trying to use this approach, which seems simple enough, to hide a column during runtime. However in my case I am having no such luck. I have tried setting the .Column["..."].Hidden = false/true,but no luck. I then invoked DataBind() on the grid itself to force the grid to redraw itself, even placing some code inside the InitializeLayout handler, but again no luck. Is it possible to hide or show a column during runtime by using this approach? Or is something more complex required, like destroying the existing grid and recreating?
Thanks,
Matt