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

change drop-down lists dynamically

Thread ID:





51470 Nov 7,2006 01:09 AM UTC Nov 15,2006 09:04 AM UTC WinForms 3
Tags: Grouping
Michael Gutkin
Asked On November 7, 2006 01:09 AM UTC

How do I change content of the drop-down list box dynamically based on the current record??? I’ve tried different approaches; one of them is when my code sets current cell datasource every time user clicks the cell. Unfourchantly this doesn't always work.
Attached is a sample code project. Open the zip file and read readme.txt.



Administrator [Syncfusion]
Replied On November 7, 2006 05:56 AM UTC

Hi Michael,

To populate the dropdown list based on the current record, you need to handle the TableControlCurrentCellShowingDropDown event and dynamically set the rowfilter for the list that is about to be displayed. And also you can handle the TableControlCurrentCellCloseDropDown event to reset the rowfilter. Please try the attached sample and let me know if you are trying something different.


Best Regards,

Michael Gutkin
Replied On November 15, 2006 02:41 AM UTC

Thank you for help. I'm still having problem with my drop downs: sometimes, when user clicks a listbox, the groupoing grid ASYNCHRONOUSLY generates following message. The message is displayed in the output window. Any IDEAS?

Here is the message:
catched at Syncfusion.Windows.Forms.Grid.GridCellButton.OnClicked(GridCellEventArgs e) in :line 0
Count = 4 FilteredRecordCount = 4 YAmountCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0
Count = 4 FilteredRecordCount = 3 YAmountCount = 45 ElementCount = 6 RecordCount = 3 CustomCount = 0 VisibleCustomCount = 0
System.ArgumentOutOfRangeException: Count = 4 FilteredRecordCount = 4 YAmountCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 out of range Count = 4 FilteredRecordCount = 3 YAmountCount = 45 ElementCount = 6 RecordCount = 3 CustomCount = 0 VisibleCustomCount = 0
Parameter name: searchPosition
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter start, ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost)
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost)
at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 counterKind, Boolean leftMost)
at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(Element el, ITreeTableCounter counter)
at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Table _table, ITreeTableCounter index, Type t, Boolean stepInNestedTables)
at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Group _group, ITreeTableCounter index, Type t, Boolean stepInNestedTables)
at Syncfusion.Grouping.FlattenedRecordsInGroupCollectionBase.get_Item(Int32 index)
at Syncfusion.Grouping.GroupTypedListRecordsCollection.System.Collections.IList.get_Item(Int32 index)
at Syncfusion.Windows.Forms.Grid.GridListControl.get_Text()
at Syncfusion.Windows.Forms.Grid.GridListControl.set_Text(String value)
at Syncfusion.Windows.Forms.Grid.GridDropDownGridListControlCellRenderer.DropDownContainerShowingDropDown(Object sender, CancelEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableDropDownListCellRenderer.DropDownContainerShowingDropDown(Object sender, CancelEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridDropDownCellImp._DropDownContainerShowingDropDown(Object sender, CancelEventArgs e)
at Syncfusion.Windows.Forms.PopupControlContainer.OnBeforePopup(CancelEventArgs args)
at Syncfusion.Windows.Forms.PopupControlContainer.ShowPopup(Point location)
at Syncfusion.Windows.Forms.Grid.GridDropDownCellImp.OnShowDropDown()
at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnShowDropDown()
at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ShowDropDown()
at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ToggleDropDown()
at Syncfusion.Windows.Forms.Grid.GridDropDownCellImp.OnButtonClicked(Int32 rowIndex, Int32 colIndex, Int32 button)
at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnButtonClicked(Int32 rowIndex, Int32 colIndex, Int32 button)
at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.ButtonClicked(Object sender, GridCellEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridCellButton.OnClicked(GridCellEventArgs e)

Administrator [Syncfusion]
Replied On November 15, 2006 09:04 AM UTC

Hi Michael,

Try setting the currency manager position of the dropdown gridlistcontrol to "ZERO" before changing the datasource of the dropdown gridlistcontrol in the TableControlCurrentCellShowingDropDown event. Here is a code snippet

private void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
GridDropDownGridListControlCellRenderer cr = e.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
Record currentRecord = e.TableControl.Table.CurrentRecord as Record;

object obj = currentRecord.GetValue("parentID");
if(cr != null && obj != null && obj.ToString() != string.Empty )
((CurrencyManager)this.BindingContext[cr.ListControlPart.DataSource]).Position = 0;
DataTable dt = cr.ListControlPart.DataSource as DataTable;
dt.DefaultView.RowFilter = string.Empty;
dt.DefaultView.RowFilter = string.Format("[ParentID] = '{0}'",obj);;

Best Regards,


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