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

[Solved] Using GridViewExpressionColumn as a datasource.

3 Answers 131 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
david mcintyre
Top achievements
Rank 1
david mcintyre asked on 10 Aug 2011, 02:09 PM
Is it possible to use a gridviewexpressioncolumn in a radgridview as a datasource for a series mapping in a bar chart?  My gridview is analogous to the one at http://demos.telerik.com/silverlight/#GridView/ExpressionColumn, and I want to chart the values in "total value in stock" in a bar chart, just like in http://demos.telerik.com/silverlight/#Chart/Gallery/Bar.  Is it possible to do this without repeating the calculation? 

Ideally, the bar chart would be updated whenever the inputs (price or qty)  were edited in the gridview as well. 

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 12 Aug 2011, 07:34 AM
Hi David Mcintyre,

Could you, please, have a look at this example, which demonstrates a scenario that seems similar to yours and would perhaps be useful for you.

Greetings,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
david mcintyre
Top achievements
Rank 1
answered on 12 Aug 2011, 01:20 PM
I don't see how the example at http://demos.telerik.com/silverlight/#Chart/EmptyValues is relevant to my needs.  In the "EmptyValues" example, the chart and the gridview are bound to a common viewmodel.  I don't want to bind the chart's dataseries to a VM, but to a calculated column that is in the gridview but not in the VM.  Are you saying that I need to move the expression from the gridview's codebehind and into the VM? 
0
Accepted
Tsvetie
Telerik team
answered on 17 Aug 2011, 12:22 PM
Hi David Mcintyre,
In short - no, it is not possible to bind the chart directly to a column in the gridview control. That is why, you should use another approach - e.g. move the expression to the VM, or to the SQL statement; add the datapoints to the series of the chart dynamically, etc. The best approach depends on your requirements and preferences.

All the best,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Chart
Asked by
david mcintyre
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
david mcintyre
Top achievements
Rank 1
Tsvetie
Telerik team
Share this question
or