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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dropdown selected item going to first of a group?

Thread ID:





45657 Jun 26,2006 07:13 PM UTC Jun 26,2006 09:41 PM UTC WinForms 2
Tags: GridControl
Curtis Gulick
Asked On June 26, 2006 07:13 PM UTC

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

Administrator [Syncfusion]
Replied On 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 + "\nSelected 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

Curtis Gulick
Replied On June 26, 2006 09:41 PM UTC

Got it, thanks Haneef!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon