|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Frank Winter
|
Oct 18, 2010 - 1:49 PM
|
Hello,
DataGridView does not work proper.
Basicly I will have a DataGriedView with some columns (checkbox,combobox,date,....). All Entries stored in a database and the combobox entries are stored in an other DB Table.
I used Elegant Ribbon v.3.6.
Here the code to reproduce the problem.
string ConnectionStr = "....";
SqlConnection CN = new SqlConnection(ConnectionStr);
SqlDataAdapter dataAdapter = new SqlDataAdapter();
//fill the combobox
string qry = "SELECT status_id, status FROM table1";
SqlCommand SqlCommandCombo = new SqlCommand(qry, CN);
CN.Open();
DataSet ComboBoxDataSet = new DataSet("CurrentStatus");
dataAdapter.SelectCommand = SqlCommandCombo;
dataAdapter.Fill(ComboBoxDataSet, "CurrentStatus");
//fill the dataset
qry = "SELECT col1, col2, col3, col4 FROM table2";
SqlCommand SqlCom = new SqlCommand(qry, CN);
dataAdapter.SelectCommand = SqlCom;
// create the DataSet
MydataSet = new DataSet("PictureStatus");
dataAdapter.Fill(MydataSet, "PictureStatus");
CN.Close();
Column Col1 = new Column();
Col1.HeaderText = " ";
Col1.DataPropertyName = "col1";
Col1.CellType = typeof(CheckBoxCell);
Col1.Width = 15;
Column Col2 = new Column();
Col2.HeaderText = "Status";
Col2.DataPropertyName = "col2";
Col2.CellType = typeof(ComboBoxCell);
Col2.Width = 70;
Col2.MappingDataSource = ComboBoxDataSet.Tables["CurrentStatus"].ToString();
Col2.MappingDisplayDataMember = "status";
Col2.MappingValueDataMember = "status_id";
Column Col3 = new Column();
Col3.HeaderText = " ";
Col3.DataPropertyName = "col3";
Col3.CellType = typeof(DateTimeCell);
Col3.Width = 15;
boundGridControl1.DataSource = MydataSet.Tables["PictureStatus"];
I hope you can help me.
|
|
Frank Winter
|
Oct 27, 2010 - 9:40 AM
|
I send a demo project with SQL files to your mail adress.
|
|
Frank Winter
|
Oct 20, 2010 - 12:20 AM
|
can anybody help me to fill the ComboBox from a DB Table, or is it a bug?
|
|
Technical Support
|
Oct 20, 2010 - 1:21 AM
|
Could you send us a simple test project that illustrates the question? Thank you.
|
|
Frank Winter
|
Oct 27, 2010 - 9:42 AM
|
I sended a demo project to you.
|
|
Technical Support
|
Oct 29, 2010 - 9:44 AM
|
Thank you for reporting this issue. It is a bug. To workaround it, please move the data binding initialization code after the point where you are adding columns to the grid: boundGridControl1.Columns.AddRange(
new Column[]
{
column1,
column2,
column3,
column4,
column5
});
if (boundGridControl1.DataSource != null) {
boundGridControl1.DataSource = MydataSet;
}
column2.MappingDataSource = ComboBoxDataSet.Tables["MyCombo"];
column2.MappingDisplayDataMember = "status";
column2.MappingValueDataMember = "status_id";
|
|