This is a migrated thread and some comments may be shown as answers.

Crash when adding filter on a calculated column

1 Answer 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 02 Sep 2015, 08:37 PM
# Context
- Using RadGridView
- Having a column named "MyDataColumn", which contains different decimal values, including zero.
- Using UI, add filter on "MyDataColumn" : "Greater than: 0"
- Added a calculated column named "MyCalculatedColumn", using expression "MyDataColumn / MyDataColumn".
- Note that, at this point, it doesn't crash since we added the "Greater than: 0" filter on "MyDataColumn" ... without that filter, it will crash, as we all know division by zero is impossible.

# Behavior
- Using UI, add a filter on "MyCalculatedColumn"
- Application crash

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Sep 2015, 07:39 AM
Hello Richard,

Thank you for writing.
 
When you use a calculated column, note that you should set a valid expression. Hence, you should avoid division by zero. When the expression is correct, no error occurs on my end with the specified version. Here is my sample code snippet. The attached gif file illustrates the behavior on my end:
private void Form1_Load(object sender, EventArgs e)
{
    this.productsTableAdapter.Fill(this.nwindDataSet.Products);
     
    GridViewDecimalColumn col = new GridViewDecimalColumn("Calculated Column");
    radGridView1.Columns.Add(col);
    radGridView1.Columns["Calculated Column"].Expression = "IIF(ReorderLevel > 0, ReorderLevel/ReorderLevel, 0)";
 
    this.radGridView1.BestFitColumns(BestFitColumnMode.AllCells);
    this.radGridView1.EnableFiltering = true;
}

I have attached my sample project as well. If you are still experiencing any further issues, please specify the exact steps how to reproduce the problem with the provided project. Thus, we would be able to investigate the precise case and assist you further. Thank you.

Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Richard
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or