i have a datagrid with a combo box added in it's columns . the combobox pulls values from a database in it's dropdownlist fashion. my problem is that when i pick a select on the combo box it doesn't stay on the cell after selected almost as if the combobox is on top of the cell and after u select an item and click next cell or column the select dissapear?
=================================================
//this part pulls from db and puts it in an arraylist
SqlConnection dbConn = new SqlConnection(strConn);
dbConn.Open();
SqlCommand SC = new SqlCommand("Select FirstName From Employee Order By FirstName",dbConn);
SqlDataReader SR=SC.ExecuteReader();
while(SR.Read())
{
temp=SR.GetString(0).TrimEnd();
EmployeeCell.Add(temp.ToString());
//pulling the first names and add to the arraylist object
}
dbConn.Close();
SR.Close();
//creating combo box
ComboBox EmployeeCB=new ComboBox();
EmployeeCB.Cursor=System.Windows.Forms.Cursors.Arrow;
EmployeeCB.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDownList;
//defining the column and added a column name employee
DC=new DataColumn("Employee");
DC.DataType=System.Type.GetType("System.String");
DT.Columns.Add(DC);
EmployeeCB.Dock=DockStyle.Fill;
//creating table style and mapping
DataGridTableStyle NewTableStyle;
NewTableStyle.MappingName=DT.TableName;//mapping datagrid
//myDatagrid is the Datagrid i'm using in my form
myDataGrid.TableStyles.Add(NewTableStyle);
//adding combo box to the first column
DataGridTextBoxColumn dgtb=(DataGridTextBoxColumn)Weld_DataGrid.TableStyles[0].GridColumnStyles[0];
dgtb.TextBox.Controls.Add(EmployeeCB);
EmployeeCB.DataSource=new ArrayList(EmployeeCell);
//adding employee array list to combo box
/////////////////////////////////////////////////////////
so this example shows a datagrid with one column with the combobox in the first column...again the problem the combobox select does not stay
pls help
thx.
=================================================
//this part pulls from db and puts it in an arraylist
SqlConnection dbConn = new SqlConnection(strConn);
dbConn.Open();
SqlCommand SC = new SqlCommand("Select FirstName From Employee Order By FirstName",dbConn);
SqlDataReader SR=SC.ExecuteReader();
while(SR.Read())
{
temp=SR.GetString(0).TrimEnd();
EmployeeCell.Add(temp.ToString());
//pulling the first names and add to the arraylist object
}
dbConn.Close();
SR.Close();
//creating combo box
ComboBox EmployeeCB=new ComboBox();
EmployeeCB.Cursor=System.Windows.Forms.Cursors.Arrow;
EmployeeCB.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDownList;
//defining the column and added a column name employee
DC=new DataColumn("Employee");
DC.DataType=System.Type.GetType("System.String");
DT.Columns.Add(DC);
EmployeeCB.Dock=DockStyle.Fill;
//creating table style and mapping
DataGridTableStyle NewTableStyle;
NewTableStyle.MappingName=DT.TableName;//mapping datagrid
//myDatagrid is the Datagrid i'm using in my form
myDataGrid.TableStyles.Add(NewTableStyle);
//adding combo box to the first column
DataGridTextBoxColumn dgtb=(DataGridTextBoxColumn)Weld_DataGrid.TableStyles[0].GridColumnStyles[0];
dgtb.TextBox.Controls.Add(EmployeeCB);
EmployeeCB.DataSource=new ArrayList(EmployeeCell);
//adding employee array list to combo box
/////////////////////////////////////////////////////////
so this example shows a datagrid with one column with the combobox in the first column...again the problem the combobox select does not stay
pls help
thx.