PC Review


Reply
Thread Tools Rate Thread

datagrid combo box selection not showing in datagrid

 
 
JL3574 l
Guest
Posts: n/a
 
      19th Oct 2005


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].GridColumnStyle
s[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.

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MVVM: Single datagrid row selection when a datagrid contains anotherdatagrid in side RowDetailsTemplate Sunita@.NET Microsoft C# .NET 0 12th Nov 2010 09:03 AM
dataGrid Selection esroinc@msn.com Microsoft C# .NET 0 11th Dec 2008 02:58 PM
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls thegame Microsoft ASP .NET 1 28th Feb 2005 04:23 PM
Datagrid: Showing and Hiding and image in a datagrid cell. Linda Mason Microsoft C# .NET 0 24th Mar 2004 10:19 PM
Re: datagrid row selection Billy Cormic Microsoft VB .NET 0 21st Aug 2003 01:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:58 AM.