datagridview: accessing embedded controls row by row

Oct 28 2009 1:57 PM
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.

Let me make up a quick example.  For a datagridview for customers here 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.

Answers (1)