Embedding controls in DataGridView

D

David C

I really hope somebody can help me with this. DataGridView is driving
me crazy.

DataGridViewComboBoxColumn does not work very well for me. That is
because values in the combo box for each row can be different
depending on the record.

Take customers as an example, and there is a column called "title."
If the customer is male, then the only allowable options should be
"Mr. Dr.". If female, then allowable options are "Mrs. Ms. Dr." You
get the idea.

How would I do that on a row by row basis? In GridView of ASP.NET, I
can use a event handler for the RowDataBound event. DataGridView does
not seem to have an event equivalent to that.

Also, I would like to embed a control that is not a built into
DataGridView. Perhaps I want to embed a third party control. In this
case, it is a special calendar control. So I do I embed it, and use
it to not just bind data, but also edit?

In ASP.NET GridView, you do do things like

DropDownList dlist = (DropDownList )e.row.FindControl("dlist");

Again, it comes down to wanting to do row by row coding with
DataGridView seems to lack.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top