The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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