Hello master, I have a problem in solving on my datagrid view with combobox inside it.
Can anyone solve this problem.
The Problem:
I have a datagrid to view a database with a specific column, in column "Map Table" I created a combobox as the Value are the column name of Table from the column "legacyclient_maptable_name" in datagrid. I want to tell the main thing that inside the datagrid column "legacyclient_maptable_name" are the name of Table in other database.
As in fact I got only the list of last row in my Combobox List. What I want is that the list of combobox is dynamic according the data in column "legacyclient_maptable_name".
Thank for the help.
Regards,
File: [ABC.cs]
dboperation.open_connection("True");
DTItems = GetAllItems();
dataGrid1.ItemsSource = DTItems.DefaultView;
foreach (DataRow row in DTItems.Rows)
{
string qGetDM = "SELECT * FROM " + row["legacyclient_maptable_name"];
List<string> MapColumn = dboperation.columnNames(qGetDM, "clientLegacyDM");
MapColumns = MapColumn;
dtcmbTes.ItemsSource = MapColumns;
}
file:[ABC.xaml]
<DataGrid AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="12,123,0,176" Name="dataGrid1" Width="1000"
ItemsSource="{Binding Path=.,Mode=TwoWay}" SelectionUnit="Cell" CanUserAddRows="False" PreparingCellForEdit="dataGrid1_PreparingCellForEdit">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding parent_id}" Header="Parent ID" />
<DataGridTextColumn Binding="{Binding report_code}" Header="Report Code" />
<DataGridTextColumn Binding="{Binding fieldname}" Header="Field Name" />
<DataGridTextColumn Binding="{Binding fieldlength}" Header="Field Length" />
<DataGridTextColumn Binding="{Binding xbrlxmltagmapping}" Header="Xbrl Tag Map" />
<DataGridTextColumn Binding="{Binding mapfield_supportsystem}" Header="mapfield_supportsystem" />
<DataGridComboBoxColumn x:Name="dtcmbTes"
Header="Map Table" Width="200"
SelectedItemBinding="{Binding mapfield_supportsystem}"
>
</DataGridComboBoxColumn>
<DataGridTextColumn x:Name="column1" Binding="{Binding legacyclient_maptable_name}" Header="legacyclient_maptable_name" Visibility="Hidden"/>
</DataGrid.Columns>
</DataGrid>
DATABASE MODEL
Table_main structure:
|autoid||Parent ID||Map Table ||legacyclient_maptable_name* |
|0 ||1 ||BlnLaporan||basel_f01 |
|1 ||2 ||UserId ||basel_f11_normal |
Table basel_f01 structure
|autoid||BlnLaporan||BlnLaporan2||BlnLaporan3|
|0 ||1 ||1200 ||22 |
|1 ||2 ||12 ||12 |
Table basel_f11_normal structure
|autoid||UserId ||UserId2 ||UserId3 |
|0 ||1 ||1500 ||62 |
|1 ||2 ||14 ||77 |
*) legacyclient_maptable_name are name of Table in other database.
#) Map Tableare column name of Table in "legacyclient_maptable_name