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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Conditional Lookups

Thread ID:

Created:

Updated:

Platform:

Replies:

91399 Nov 16,2009 09:30 PM UTC Nov 23,2009 10:36 AM UTC WinForms 1
loading
Tags: GridControl
Sergey Merkuriev
Asked On November 16, 2009 09:30 PM UTC

I have question about GridGroupingControl: How to display lookup data in the combobox depend on condition from other column?

If I will use approach with GridRelationDescriptor then it will not works cause I need filter related data source (add/remove items) depend on value in the column of selected row. In it's turn it will break representation cause number of cells will become blank from absence data in the related datasource.

May be it make sense to display my custom combobox control with filtered values when user edit value. How to do that?


Rajadurai C [Syncfusion]
Replied On November 23, 2009 10:36 AM UTC

Hi Sergey,

Thanks for your interest in Syncfusion Products.

I apologize for the delay caused in responding.

To customize the dropdownlist in a combobox cell based on the other column value of that corresponding record, you can handle the TableControlCurrentCellActivated and TableControlCurrentCellShowingDropDown events with similar kind of code as shown below which is implemented in the attached sample.

GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);
GridCurrentCell cc = e.TableControl.CurrentCell;
if (style.TableCellIdentity.Column.Name == "Department" && cc.Renderer is GridComboBoxCellRenderer)
{
GridComboBoxCellRenderer rend = cc.Renderer as GridComboBoxCellRenderer;
if (rend != null)
{
if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Record rec = style.TableCellIdentity.DisplayElement.GetRecord();
if (rec.GetValue("Year").ToString() == "I")
{
rend.ListBoxPart.Items.Clear();
rend.ListBoxPart.Items.AddRange(new object[] { "CIVIL", "MECHANICAL", "EEE", "ECE" });
}
else if (rec.GetValue("Year").ToString() == "II")
{
rend.ListBoxPart.Items.Clear();
rend.ListBoxPart.Items.AddRange(new object[] { "CSE", "IT", "BIO-TECH", "AERO" });
}
else if (rec.GetValue("Year").ToString() == "III")
{
rend.ListBoxPart.Items.Clear();
rend.ListBoxPart.Items.AddRange(new object[] { "MARINE", "CSE", "TEXTILE", "ECE" });
}
else if (rec.GetValue("Year").ToString() == "IV")
{
rend.ListBoxPart.Items.Clear();
rend.ListBoxPart.Items.AddRange(new object[] { "EEE", "MECHANICAL", "CSE", "AERO" });
}
}
}
}

Sample:
F91399-1524680981.zip

Regards,
Rajadurai

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

;