AD
Administrator
Syncfusion Team
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.
http://www.syncfusion.com/Support/user/uploads/ChangeDropDownlist_c6cd64a6.zip
Best Regards,
Haneef
MG
Michael Gutkin
November 15, 2006 02:41 AM UTC
Haneef,
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)
AD
Administrator
Syncfusion Team
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,
Haneef