The GridDropDownColumn is one of the most often used and yet I struggle (and many other as seen in the counless forum questions) with the fundamentls probably due to very weak documenatation and description of strategies and common approaches.
If the grid represents a data table tbl_A, then most likely the GridDropDownColumn will represent a value tbl_A_value that is taken from another list lets say tbl_B (tbl_B_value, tbl_B_description). In the view mode, we want the grid to find description corresponding to tbl_A_value from tbl_B. In the edit mode, we would want all the choices from tbl_B to appear in the drop down box.
I represent tbl_A and tbl_B through datasets and datatables. Since, the tbl_B is virtually static and is the same for all the items in the collumn, I feel that there should be one place to initialize the internal GridDropDownColumn. I really don't think that the ItemDataBound() is the right place to do so. I tried several approaches but none of them worked:
1) Defined GridDropDownListColumnEditor in aspx and in PageLoad() defined its DataSource by assigning the appropriate DataTable.
2) Also in PageLoad(), I casted grid column from MasterView to GridDropDownColumn and tried to assign appropriete values but don't know how to assign DataSource since only DataSourceID (string) is available to be set.
I guess I would like someone to post example on how to do GridDropDownColumn most efficiently using DataSet or DataTable solutions and no embedded SQL statements.
Chris
If the grid represents a data table tbl_A, then most likely the GridDropDownColumn will represent a value tbl_A_value that is taken from another list lets say tbl_B (tbl_B_value, tbl_B_description). In the view mode, we want the grid to find description corresponding to tbl_A_value from tbl_B. In the edit mode, we would want all the choices from tbl_B to appear in the drop down box.
I represent tbl_A and tbl_B through datasets and datatables. Since, the tbl_B is virtually static and is the same for all the items in the collumn, I feel that there should be one place to initialize the internal GridDropDownColumn. I really don't think that the ItemDataBound() is the right place to do so. I tried several approaches but none of them worked:
1) Defined GridDropDownListColumnEditor in aspx and in PageLoad() defined its DataSource by assigning the appropriate DataTable.
2) Also in PageLoad(), I casted grid column from MasterView to GridDropDownColumn and tried to assign appropriete values but don't know how to assign DataSource since only DataSourceID (string) is available to be set.
I guess I would like someone to post example on how to do GridDropDownColumn most efficiently using DataSet or DataTable solutions and no embedded SQL statements.
Chris