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.

Expression Column in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

116102 Apr 2,2014 02:46 PM Apr 3,2014 02:19 AM ASP.NET Web Forms (Classic) 2
loading
Tags: GridGroupingControl
Alex Segal
Asked On April 2, 2014 02:46 PM

Currently my dataTable for the mapped column returns a double. My implementation is roughly as follows:
efd.Expression = "[Score]*100";
efd.Name = "ScorePercent";

I get values like 98.4490849790879

I need to implement something like C# method Math.Round() in my GridGroupingControl Expression column.

Is it possible?

Thank you in advance,

 

    


Eswari S [Syncfusion]
Replied On April 3, 2014 02:18 AM

Hi Alex,

 

Thank you for using Syncfusion products.

 

Your requirement can be achieved by adding custom function to ExpressionFieldEvaluator. Please refer to the following code snippets:

 

// Add function named Func that uses a delegate named ComputeFunc to define a custom calculation

        ExpressionFieldEvaluator evaluator = this.GridGroupingControl1.TableDescriptor.ExpressionFieldEvaluator;

        evaluator.AddFunction("Func", new ExpressionFieldEvaluator.LibraryFunction(ComputeFunc)); 

        Syncfusion.Web.UI.WebControls.Grid.Grouping.GridExpressionFieldDescriptor efd = new GridExpressionFieldDescriptor();

       

        // define expression using custom function.

        efd.Expression = "Func([ID]+ 50.9)";

        efd.Name = "ID + 500";

        this.GridGroupingControl1.TableDescriptor.ExpressionFields.Add(efd);

 

//compute func

  public string ComputeFunc(string s)

    {

        return Math.Round(Convert.ToDecimal(s)).ToString();

    }

 

For your convenience , we have attached the sample.

 

Please try this and let us know if you have any queries.

 

Regards,

Eswari S


Eswari S [Syncfusion]
Replied On April 3, 2014 02:19 AM

Hi Alex,

Please find sample from the attachment.

Regards,
Eswari S

Attachment: 122993_407cdccf.zip

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.

;