Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone Creating Custom Grid Columns + Custom Properties?
Message
From
27/02/2008 20:45:09
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01296404
Message ID:
01297228
Views:
20
Hey Derek,

That's what I did also, using my regular custom controls (MyTextBox, etc.) in the DataGrid columns. The only reason I used the DataGrid instead of the DataGridView, because the only example I could find for what I wanted to do was for the DataGrid. What I needed to do was to add the columns dynamically, according to metadata about what kind of data type should live in that particular cell ... you know, like needing a DateTimeControl in the cell, or a ComboBox.

I'm not saying it couldn't be done in the DataGridView, but the behavior and events and all of the DataGridView is radically different from the DataGrid ... I was having enough trouble trying to get the example to fit as it was. To then take that and try to retrofit it to the DataGridView was not worth it to me.

>But it surprises me more that there are so few here that have gone into customizing columns in DataGridView.

If I used a lot of Grids, then I'd have a ton of examples for you about how to do this. But we haven't standardized our app's look and feel with Grids. We use ListViews for that kind of thing (I know, a lot more work since they're not databound, but they look more like a lot of typical Windows UI). This Grid with the dynamic columns is the only Grid we use in our app (and it's all data-driven), but we don't use it for the bulk of our UI.

Anyway, I'm sure that plenty of people are using Grids and writing customized columns. Maybe no one got around to answering your question. <g>

~~Bonnie


>Thanks Bonnie!
>
>Well, I've gotten past most of it, about 4-5 days on grid (DataGridView), custom columns with custom properties and delegates. It was very difficult because the documentation is scattered and difficult to follow. It being too large to print is not an excuse, in my mind, for the terrible state of documentation.
>
>My regular custom controls (textbox, checkbox, combobox, etc...) go right into the custom grid columns nicely so I'm using objects that I've created without creating new. Getting it to work has been trial and error! Clone() really threw me; what helped was looking through VS 2008 bug reports online where I found four other posts about the same issue and the answer was to use clone() on the custom column.
>
>Luckily I've had the MacDonald book, which has a fantastic chapter on DataGridView (thank heavens for it), but about six other books that I have spend, at most, a few pages on DataGridView - which is not right for a book that costs $50 and is about winform controls!
>
>But it surprises me more that there are so few here that have gone into customizing columns in DataGridView.
>
>Be well. I will have to spent more time over at MSDN for q&a.
>
>Kind regards,
>Derek
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform