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

GridGroupingControl column expression

Thread ID:

Created:

Updated:

Platform:

Replies:

30460 Jun 17,2005 06:28 PM UTC Jun 20,2005 10:10 AM UTC WinForms 3
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On June 17, 2005 06:28 PM UTC

In GridGroupingControl, In one column, row1''s expression is not the same with row2''s expression. if should custom it,which event i will handle? how to do this? 3ks! e.g: c1 c2 c3 exp1 10 5 2 c1+c2+c3 2 3 2 c1*c2*c3

Administrator [Syncfusion]
Replied On June 17, 2005 09:11 PM UTC

You should create a unbound field and then handle the QueryValue event, e.g. this.gridGroupingControl1.QueryValue += new FieldValueEventHandler(gridGroupingControl1_QueryValue); private void gridGroupingControl1_QueryValue(object sender, FieldValueEventArgs e) { if (e.TableDescriptor.Name == "ReportsTo" && e.Field.Name == "LastNameAndTitle") { // "[LastName] + ''('' + [Title] + '')''")); e.Value = String.Format("{0} ({1})", e.Record.GetValue("LastName"), e.Record.GetValue("Title")); } } Stefan >In GridGroupingControl, >In one column, row1''s expression is not the same with row2''s expression. >if should custom it,which event i will handle? > >how to do this? >3ks! >e.g: > >c1 c2 c3 exp1 >10 5 2 c1+c2+c3 >2 3 2 c1*c2*c3 >

Administrator [Syncfusion]
Replied On June 20, 2005 01:56 AM UTC

hi,stefan, If i want to calc (row1/row2) in QueryValue, how can i do? in my App,some row''s unbound filed is column expression,but some row is row calculation: e.g: col1 col2 exp1 10 5 col1+col2 2 3 col1+col2 10/2 5/3 (col1+col2)/(col1+col2) if using QueryValue,how can i do? >You should create a unbound field and then handle the QueryValue event, e.g. > > > this.gridGroupingControl1.QueryValue += new FieldValueEventHandler(gridGroupingControl1_QueryValue); > > > private void gridGroupingControl1_QueryValue(object sender, FieldValueEventArgs e) > { > if (e.TableDescriptor.Name == "ReportsTo" && e.Field.Name == "LastNameAndTitle") > { > // "[LastName] + ''('' + [Title] + '')''")); > e.Value = String.Format("{0} ({1})", e.Record.GetValue("LastName"), e.Record.GetValue("Title")); > } > } > > >Stefan >>In GridGroupingControl, >>In one column, row1''s expression is not the same with row2''s expression. >>if should custom it,which event i will handle? >> >>how to do this? >>3ks! >>e.g: >> >>c1 c2 c3 exp1 >>10 5 2 c1+c2+c3 >>2 3 2 c1*c2*c3 >>

Administrator [Syncfusion]
Replied On June 20, 2005 10:10 AM UTC

You will have to write the code to retrieve whatever data you want to use in the calculation. Here is a handler that, for every third item in the column, divides the sum of the previous 2 items.
private void gridGroupingControl1_QueryValue(object sender, FieldValueEventArgs e)
{
	int row = e.Record.ParentChildTable.Records.IndexOf(e.Record);
	if(row > 1 && (row+1) % 3 == 0)
	{
		GridRecord rec1 = e.Record.ParentChildTable.Records[row-1] as GridRecord;
		GridRecord rec2 = e.Record.ParentChildTable.Records[row-2] as GridRecord;
		e.Value = (double) rec2.GetValue("exp") / (double)rec1.GetValue("exp");
	}
	else
	{
		e.Value = (double)((int)e.Record.GetValue("Col1") + (int)e.Record.GetValue("Col2"));
	}
}
 

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

;