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.

Problem grouping a CombobBox column

Thread ID:

Created:

Updated:

Platform:

Replies:

78906 Jan 9,2009 10:41 AM Jan 13,2009 07:41 AM Windows Forms 4
loading
Tags: GridControl
Fabian
Asked On January 9, 2009 10:41 AM

Hi

I'm using the GridGroupingControl version 4.4.0.51.

The application I'm workin on uses several combobox columns which I want to group. The
comboboxes have their own datasource, so that in these columns the grid datasource only contains an ID and not an actual value. The text is displayed by the combobox.
This works well and grouping also works, but with one big problem: the grid shows the ID in the grouped row and not the value of the cell. Grouping becomes worthless because of this, because the ID is completly useless to the user.

I'm using the standard CaptionText: "{CategoryCaption} : {Category} - {RecordCount} Items"

Hopefully that was understandable and anybody can help me.


Nisha Arockiya A [Syncfusion]
Replied On January 12, 2009 08:02 AM


Hi Fabian,

Thanks for your interest in Syncfusion Products.

I am afraid that I couldnot able to reproduce the issue here. Can you modify the attached sample to reproduce the issue so that we will work on it here for you? In the meantime, you can handle the TableControlCurrentCellCloseDropDown event to modify the value in the currentcell.

EditGGC.zip

Please let me know if this helps.

Regards,
Nisha.


Fabian
Replied On January 12, 2009 09:18 AM

OK, I modified the example. You simply have to group "Col2". The grouping row (the one with the +) will only show the numbers and not "value_1" etc.

I want to see the displaymember there and not the valuemember. I hope it's clear now what I'm talking about.



EditGGC_updated_d72ae245.zip

Nisha Arockiya A [Syncfusion]
Replied On January 13, 2009 05:41 AM

Hi Fabian,

Thanks for the update.

The DisplayMember Value can be set in the Caption by handling the QueryCellStyleInfo event handler. In the QueryCellStyleInfo event handler check for the particular (ComboBox column) group name (the name of the column by which the group is categorized) and get the display member for the Category/value member from the table and set it in the e.Style.Text.


void sortGrouping_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
GridGroupingControl grid = sender as GridGroupingControl;
if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
Group group = e.TableCellIdentity.DisplayElement.ParentGroup;
if (group.Category != null && group.Name == "ID")//Check for the ComboBox(lookup) column
{

DataRow[] dr = dt.Select("Lookup_id = " + group.Category.ToString());
if (dr.GetLength(0) > 0)
{
string dispCat = dr[0]["Lookup_member"].ToString();
e.Style.Text = grid.TableDescriptor.Columns[group.Name].HeaderText + ": " + dispCat + " - " + group.GetFilteredRecordCount().ToString() + " Items.";
e.Handled = true;
}

}
}
}


Here is a sample.

Please let me know if this serve your needs.

Regards,
Nisha.


Fabian
Replied On January 13, 2009 07:41 AM

Yes, that seems to work.

Thank you very much!


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.

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.

;