how to add comboboxes in the first row of datagridview.

A

ashishtarlekar

Hi all,
I have to add comboboxes in the first row of datagridview for
mapping the database fields.
For e.g. I have to show Id, FirstName, LastName in each comboboxes in
the first row. if i select a database which contains 2 fields then
this data should be displayed from second row so that the user can
choose the header name for this two columns from comboboxes like Id,
FirstName, LastName etc.
Can anybody tell me the solution?


Thanks,
Ashish Taralekar.
 
C

ClayB

One way to try to do this is to use the DataGridView in VirtualMode,
setting this property to true and not setting the DataSource property.
Then in the CellValueNeeded event, you can dynamically provide the
information necessary for your first row, and then for row 2 on, you
can provide values from your DataSource. You will likely have to
handle CellValuePushed as well, and also set the rowcount and column
count appropriately. It will take a little coding to get things
working.

======================
Clay Burch
Syncfusion, Inc.
 
A

ashish taralekar

One way to try to do this is to use the DataGridView in VirtualMode,
setting this property to true and not setting the DataSource property.
Then in the CellValueNeeded event, you can dynamically provide the
information necessary for your first row, and then for row 2 on, you
can provide values from your DataSource. You will likely have to
handle CellValuePushed as well, and also set the rowcount and column
count appropriately. It will take a little coding to get things
working.

======================
Clay Burch
Syncfusion, Inc.


Hi Clay,
I tried to implement datagridview in virtualmode and written the
code to add comboboxcolumns into the DataGridView1_CellValueNeeded
event but when i debug this code then the control is not going into
this event. I am not getting when this event will fire.


Thanks,
Ashish Taralekar.
 

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