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

Display name in grouping drop area

Thread ID:

Created:

Updated:

Platform:

Replies:

30160 Jun 13,2005 01:24 PM UTC Jun 14,2005 11:35 AM UTC WinForms 5
loading
Tags: GridControl
Prathima Venkobachar
Asked On June 13, 2005 01:24 PM UTC

I am binding a datatable to a GroupingGrid control.If I drag the column to the drop area it dispalys whatever display(Header text) name given to the grid.But when I try to externally set the group by columns I am using Mapping name to add the group by columns. So when I do the grouping it displays mapping name..which is a database field name.I want to give meaning full name instead of database name. Is there anyway i can specify hearder text for grouping columns. i am using SortColumnDescriptorCollection groupedColumns = sfgAssetView.TableDescriptor.GroupedColumns; groupedColumns.Clear(); groupedColumns.Add(MappingName); Thx, Prathima

Administrator [Syncfusion]
Replied On June 13, 2005 02:23 PM UTC

Did you try assigning this.gridGroupingControl1.TableDescriptor.Columns[MappingName]HeaderText (even if the column is not visible)? The grouping should pick up the HeaterText just as if you had used the UI to group it.

Prathima Venkobachar
Replied On June 14, 2005 06:36 AM UTC

I have used GridColumDesc to specify mapping name and the headertext. GridColumnDescriptor colDescriptor1 = new GridColumnDescriptor(); I am adding GridColumnDescriptor to the visible columns. gridgroupingcontrol.TableDescriptor.Columns[MappingName] = colDescriptor1; gridgroupingcontrol.TableDescriptor.VisibleColumns.Add(colDescriptor1.Name); I will be getting the display column information and grouped column information in the datatable. I will add only display column to the visible column collection. I doesn''t add grouped coulmns to the visible columns.

Administrator [Syncfusion]
Replied On June 14, 2005 08:14 AM UTC

I do not understand what you want to do. I thought you have this column in your grid: gridgroupingcontrol.TableDescriptor.Columns[MappingName] = colDescriptor1; gridgroupingcontrol.TableDescriptor.VisibleColumns.Add(colDescriptor1.Name); and when you group by this column you want to see something other than the MappingName, correct? Did you set gridgroupingcontrol.TableDescriptor.Columns[MappingName].HeaderText to what you want to see, and it does not work? Is that the problem? Or, do you want to do something entirely different, like have a column of key values in your grid, but display a column of description values instead? If so, you can use a foreign reference lookup. There is a sample in this thread. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=28679

Prathima Venkobachar
Replied On June 14, 2005 10:46 AM UTC

My grouping column may not be a display filed in the grid. Also I have given proper headertext in the grid and displaying properly. I will try to explain what i am doing and what I want.Hope this will help you to understand and the problem. Based on the some criteria I will get the display columns and grouping column to be applied to the grid. I will create a datable to hold the values of display columns and grouped columns. This datatable I will bind it to the grid. As I am storing grouped column information only for the purpose of grouping ,I don''t add it to the visible column collection. As I told earlier grouping column may not be visible column in the grid. grouping column will be there in the grid but not added to the visible column collection. Here the problem is Grouping works fine.But the Groupdrop area displays the column name which is there in the datatable. I want to display a meaningfull name in the groupdroparea. Hope this helps. Prathima

Administrator [Syncfusion]
Replied On June 14, 2005 11:35 AM UTC

You can try using QueryCellStyleInfo and setting the text there if it is your Caption cell being requested. Here is code that will swap the text when the grid is grouped on "Col2".
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
	if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
	{
		Group g = e.TableCellIdentity.DisplayElement.ParentGroup;
		if(g != null && g.CategoryColumns.Count > 0 && g.CategoryColumns[0].Name == "Col2")
		{
			e.Style.Text = "SomethingMeaningfulFor-" + g.Category.ToString(); 
		}
	}
}

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

;