Geeks With Blogs
Jeff Scranton .Net and other programming blather...

Gotta get this one off my chest:

Using a custom collection that was created by LLBLGenPro.

Why is it that I can databind (OK, this is something I rarely do but in this case, it's the right call) a collection of objects to a DataGrid but if I don't set the datamember property I simply cannot "hide" a column on the control?

I don't have anything against Infragistics controls (well, they can be kinda 'heavy' if you know what I mean) and am using their UltraGrid in place of the standard DataGrid. As with the UltraGrid, using the standard DataGrid I should be able to access the columns collection after the control is bound and hide/set width = 0 on any column in the collection shouldn't I? C'mon Microsoft, fix this please!

Ahh, I feel much better now.

Feel free to flame away on this topic...perhaps I missed something somewhere but using the UltraGrid, I can do pretty much what I want to do with relative ease. And...I also realize that MS might want it this way so that companies like Infragistics can have products to market.

L8tr,

Jeff

Posted on Tuesday, December 6, 2005 9:53 AM | Back to top


Comments on this post: Databinding a collection to a DataGrid

# re: Databinding a collection to a DataGrid
Requesting Gravatar...
I don't know how UltraGrids work, but for the DataGrid I'd suggest trying the databinding with the DataMember set to a DataView object that you create specifying just the columns you want to see.

Or, if this is an ASP.NET project, you could even "strong-arm" it and override ItemDataBound(), specifying in nitty-gritty detail where you want each piece of data to go.

My $0.02 anyway.
Left by Alex on Dec 06, 2005 12:27 PM

# re: Databinding a collection to a DataGrid
Requesting Gravatar...
Jeff,

I think Infragistics is the way to go. I do understand what you mean by heavy, but it has never failed me (winform and webform). Especially when binding to custom objects/collections. Can't beat the automatic hierarchical band creation either.

-chaz
Left by --chaz on Dec 06, 2005 4:24 PM

Your comment:
 (will show your gravatar)


Copyright © Jeffrey Scranton | Powered by: GeeksWithBlogs.net