473,385 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

datagrid combo box selection not showing in datagrid



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.Arr ow;
EmployeeCB.DropDownStyle=System.Windows.Forms.Comb oBoxStyle.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.TableSty les[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 ***
Nov 17 '05 #1
0 1594

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
0
by: Toff McGowen | last post by:
Hello How do i maintain viewstate of dropdownlists for client side postback when they are used as selection controls in the column of a datagrid? I have a datagrid that has a dropdownlist as a...
6
by: Brian Henry | last post by:
Here's an example of the code.. I have two combo boxes on screen that when one's selection is change the other's items will be updated to reflect the change (based on a relation) Private...
5
by: Niels | last post by:
Hi There, I have a form with a datagrid, and some text/combo-boxes and a button. When I select a record in the datagrid an press the button I want to see the valeus of the cells from tehe...
6
by: Doug Bell | last post by:
Hi I have a datagrid with a combo box, I need to populate the combo with data dependant on the record value. eg for record 1, field Warehouse = 2R so combo would allow selection of locations...
3
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in...
3
by: Torilyn73 | last post by:
I posted this earlier... or thought I did... anyway.. it's doesn't appear in the list so I'm reposting it. Can someone please explain to me how to set up the lostfocus event for a combo box. I...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.