datagrid problem?
-
its very urgent regarding datagrid. i want to put combobox in the datagrid. i have search the web and codeproject but normally these are set with Dock style "Fill" :( but infact i want without of this. I also want to bind datagrid with the Datatable. Is this possible without using the "DatagridTableStyle" class. Kindly friends tell me many ways so that i will select best i want. Thanks and regards Muhammad Sarfraz
-
its very urgent regarding datagrid. i want to put combobox in the datagrid. i have search the web and codeproject but normally these are set with Dock style "Fill" :( but infact i want without of this. I also want to bind datagrid with the Datatable. Is this possible without using the "DatagridTableStyle" class. Kindly friends tell me many ways so that i will select best i want. Thanks and regards Muhammad Sarfraz
Using a
DataGridColumnStyle
is the best way to do this. That's what they're there for - to customize the data-bindable cells in aDataGrid
. There's an easy article about this in MSDN posted a few months ago at http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx[^]. If you don't want to use this mechanism, then handle theDataGrid.CurrentCellChanged
event, determine if you should show aComboBox
for the current cell, then add aComboBox
to theDataGrid
's container'sControls
collection with a higherTabStop
than theDataGrid
, and size theComboBox
to match the cell's extents. This is a really poor way of handling this and I'm not guaranteeing that it'll work.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----