M
Michael Schindler
why see my combobox not in datagrid with values(offen, closed) not to column
the 5?
Please help me!
This is my first combobox and i have no idea what i can to do.
My source:
private void button1_Click(object sender, System.EventArgs e)
{
ComboInTheGrid();
}
private void ComboInTheGrid()
{
// Create a table style that will hold the new column style
// that we set and also tie it to our customer's table from our DB
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = "tblFiBuPeriode";
DataTable dt = ds.Tables["tblFiBuPeriode"];
// make the dataGrid use our new tablestyle and bind it to our table
for(int i = 0; i < dt.Columns.Count; ++i)
{
if(i == 5)
{
DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn();
tableStyle.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 2;
ComboTextCol.MappingName = "Status";
tableStyle.GridColumnStyles.Add(ComboTextCol);
ComboTextCol.ColumnComboBox.Items.Clear();
ComboTextCol.ColumnComboBox.Items.Add("Open");
ComboTextCol.ColumnComboBox.Items.Add("Close");
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
}
else
{
// Nothing
}
}
}
The datasource is the datasource from the hole datagrid that i have.
I have a datagrid with columns and i want in the last column a choice open
or close in my datagrid...it is this possible and how?
Thanks and i hope your understand my english![Smile :-) :-)](/styles/default/custom/smilies/smile.gif)
Thanks
Michael
the 5?
Please help me!
This is my first combobox and i have no idea what i can to do.
My source:
private void button1_Click(object sender, System.EventArgs e)
{
ComboInTheGrid();
}
private void ComboInTheGrid()
{
// Create a table style that will hold the new column style
// that we set and also tie it to our customer's table from our DB
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = "tblFiBuPeriode";
DataTable dt = ds.Tables["tblFiBuPeriode"];
// make the dataGrid use our new tablestyle and bind it to our table
for(int i = 0; i < dt.Columns.Count; ++i)
{
if(i == 5)
{
DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn();
tableStyle.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 2;
ComboTextCol.MappingName = "Status";
tableStyle.GridColumnStyles.Add(ComboTextCol);
ComboTextCol.ColumnComboBox.Items.Clear();
ComboTextCol.ColumnComboBox.Items.Add("Open");
ComboTextCol.ColumnComboBox.Items.Add("Close");
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
}
else
{
// Nothing
}
}
}
The datasource is the datasource from the hole datagrid that i have.
I have a datagrid with columns and i want in the last column a choice open
or close in my datagrid...it is this possible and how?
Thanks and i hope your understand my english
![Smile :-) :-)](/styles/default/custom/smilies/smile.gif)
Thanks
Michael