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
>
> 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
>>
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")); } }