Combobox in DataGrid in .NET
The datagrid is really a pain to work with sometimes. This datagrid for .NET is very basic and so if you need complicated functionality like comboboxes, you would have to make your own. There are lots of postings about getting dropdowns in the datagrid by deriving from the DataGridTextBoxColumn column style. I tried using this, but for my purpose, I had two columns of combos, where the second gets filtered based on the selection in the first. In such a case, the derived column style will not work as you have to change content of combos on a per row basis, whereas the column style is for the entire column.
So eventually, I just ended up having a combo on top of the grid and moving around the combo to the cell that gets focus and then write its values to the cell. You would have to do a lot more depending on what your requirements are.
Hope this helps. If you have any issues, questions or remarks, feel free to comment.
0 Comments:
Post a Comment
<< Home