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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

change dropdown list content based on current record.

Thread ID:

Created:

Updated:

Platform:

Replies:

49109 Sep 11,2006 10:09 PM UTC Sep 12,2006 08:45 AM UTC Windows Forms 1
loading
Tags: Grouping
Michael Gutkin
Asked On September 11, 2006 10:09 PM UTC

I need to change a content of dropdown list in my grouping control based on the current record.
Here is what I did:
1. I bound dropDown list column for each group level to listSource
grid.Engine.SourceListSet.Add("UserActions", dvActions);
2. Added myControlo_TableControlCurrentCellShowingDropDown event to catch when user clicks the dropdown.
3. use CurrentCell value in the event to identify what control (what column) was clicked.
int ColIndex = ((Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl)(sender)).TableControl.CurrentCell.ColIndex;

5. Use ColIndex to identify column name to decide what function to call for the given control.

string tableName = ((GridTableControlCurrentCellShowingDropDownEventArgs)e).TableControl.Table.CurrentRecord.ParentChildTable.Name;

string colName = ((Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl)(sender)).GetTableDescriptor(tableName).Columns[ColIndex].Name;

6. change Filter value based on the current record and clicked control:
string filerValue ="RuleID = ''" + ((Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl)(sender)).Table.CurrentRecord.GetValue("_ruleID").ToString() + "''";
dvActions.RowFilter = filerValue;

My problem is that ColIndex value not always what I expect it would be. Therefor colIndex translation to column name not always work!!!
Does anybody knows how to convert current cell index to a currect datacolumn index???

Administrator [Syncfusion]
Replied On September 12, 2006 08:45 AM UTC

Hi Michael,

Use this code snippet to get the current column information in TableControlCurrentCellShowingDropDown event.

int index = e.TableControl.TableDescriptor.ColIndexToField(e.TableControl.CurrentCell.ColIndex);

Console.WriteLine("Current Column Name : " + e.TableControl.TableDescriptor.VisibleColumns[index].Name );

Best Regards,
Haneef

CONFIRMATION

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.

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

;