Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a ComboBox to a DataGrid
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Adding a ComboBox to a DataGrid
Divers
Thread ID:
00863988
Message ID:
00863988
Vues:
56
---------------------------------
I'm wanting to add a ComboBox to my DataGrid.
I've looked at the example at http://www.syncfusion.com/FAQ/WinForms/FAQ+c44c.asp
Step 1. Derive a custom column style from DataGridTextBoxColumn 
 a) add a ComboBox member 
 b) track when the combobox has focus in Enter and Leave events 
 c) override Edit to allow the ComboBox to replace the TextBox 
 d) override Commit to save the changed data 
 
Step 2 - Use the combo column style 
Add 1 col with combo style 
	DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(); 
	ComboTextCol.MappingName = "custCity"; 
	ComboTextCol.HeaderText = "Customer Address"; 
	ComboTextCol.Width = 100; 
	ts1.GridColumnStyles.Add(ComboTextCol); 
 
Step 3 - Additional setup for Combo style
a) make the row height a little larger to handle minimum combo height 
	ts1.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 3; 
b) Populate the combobox somehow. It is a normal combobox, so whatever... 
	ComboTextCol.ColumnComboBox.Items.Clear(); 
	ComboTextCol.ColumnComboBox.Items.Add("Chicago"); 
	ComboTextCol.ColumnComboBox.Items.Add("Corvallis"); 
	ComboTextCol.ColumnComboBox.Items.Add("Denver"); 
c) set the dropdown style of the combo... 
	ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList; 
I think I understand the general approach, but I don't know VB.Net well enough to do it. (I am signing up for a class at my local community college, but it won't start for 2 weeks yet)

Can someone walk me thru this process?

To start with...
How do I go about deriving a custom column style?

Thanks,
Rick
---------------------------------
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform