DataGridView Best Practices

DataGridView Best Practices

Old forum URL: forums.lhotka.net/forums/t/2324.aspx


JZuerlein posted on Monday, February 12, 2007

The DataGridView control has become a thorn in my side.  I’ve seen enough posts on the topic to know I’m not the only one.  Has anyone written a document, or program that demonstrates the best way to use a DataGridView control with CSLA list objects? 

 

If not, does it make sense to create one? 

If it does, would anyone be willing to contribute to the effort?

 

Thoughts?

 

Jeff

Brian Criswell replied on Monday, February 12, 2007

What are you trying to do with the DataGridView?

Possibly this could be something that went into the CSLA FAQ.  I am not sure anyone has a list of things to do, but it would probably not be too hard to build up a question and answer list over time.

xal replied on Monday, February 12, 2007

How about giving the wiki some use??

http://www.lhotka.net/wiki/

Andrés

ajj3085 replied on Tuesday, February 13, 2007

Well, most problems stem from not having a unique id for NEW objects added to the collection.  This is covered in the FAQ.  Other problems seem to be resolved by tossing a BindingSource component between the grid and the actual object collection.  Thats the MS recommended way to do databinding anyway.. but might be a good thing to add to the FAQ.

What issues exactly are you running into?  Once I did the above two things, the DGV worked wonderfully for me.  The only reason I stopped using it was because the Infragistics grid has a lot of extra features that I wanted.

One last thing regarding the FAQ.. if you do see a topic that's continually appearing, suggest it to me that I add it to the FAQ..

JZuerlein replied on Tuesday, February 13, 2007

I agree that most of the problems stem from a handful of issues.

AddNewCore, UniqueIDs, BindingSource....

I've also had some fun with canceling edits, validation of rows, multiple combo box columns, etc.  Some of this is probably more about the DataGridView control then CSLA, but I bet most people end up using the control in their apps, and would benefit from sample code.

I'm going on Vacation next week, when I get back I'll try to post what I've been able to put together.  If people think it's worthy, the community can use it.  If anyone sees bugs, or knows better ways of doing things, I'd love to hear about it. 

Sound good?

Jeff

Brian Criswell replied on Tuesday, February 13, 2007

That sounds good.  I think Xal's idea of filling out the wiki about is really good.

Copyright (c) Marimer LLC