We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dropdown selected item going to first of a group?

I''m not sure exactly what is causing this, but i have the following select statement going into a dataset for the datasource of a dropdown: SELECT Code, Name, Region, Name + \'' / \'' + Region AS DisplayName FROM Institution WHERE ClosedDate is null ORDER BY Name + \'' / \'' + Region The list populates correctly but when I select an item in the drop down which has multiple records with the same Name, but different regions, it is always setting the selected item to the top one on the list of those Names. Is there something I''m missing somewhere that is causing this? Thanks, Curtis

2 Replies

AD Administrator Syncfusion Team June 26, 2006 08:57 PM UTC

Hi Curtis, The Attached also describes how to get correct index value from same Items("AAA" and "AAA"). It implements the CurrentCellCloseDropDown event for assinging the correct Selected index to the combobox cell in a grid and Renderer''s ListBoxPart.MouseDown event for finding the correct Selected index of the combobox cell. Please find the code snippet below. In Form Load Event Handler GridComboBoxCellRenderer cr =(GridComboBoxCellRenderer) this.gridControl1.GetCellRenderer(2,2); cr.ListBoxPart.MouseDown +=new MouseEventHandler(ListBoxPart_MouseDown); //for assigning the Selected index. private void gridControl1_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e) { if(e.PopupCloseType == PopupCloseType.Done) { GridComboBoxCellRenderer cr =(GridComboBoxCellRenderer) this.gridControl1.GetCellRenderer(this.gridControl1.CurrentCell.RowIndex,this.gridControl1.CurrentCell.ColIndex); if(cr != null) { MessageBox.Show( "Selected Index from Mouse Down ::::" + index + "Selected Index From close Dropdown :::" + cr.ListBoxPart.SelectedIndex ); cr.ListBoxPart.SelectedIndex = index; } } } //For finding the selected index private void ListBoxPart_MouseDown(object sender, MouseEventArgs e) { if(e.Clicks == 1) { ListBox listbox = sender as ListBox; index = listbox.SelectedIndex; } } Here is a sample http://www.syncfusion.com/Support/user/uploads/casesense_8ebfeeae.zip Let me know if you need any further assistance. Regards, Haneef


CG Curtis Gulick June 26, 2006 09:41 PM UTC

Got it, thanks Haneef!

Loader.
Live Chat Icon For mobile
Up arrow icon