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

Getting access to strongly typed object that I've bound the PivotGrid to

1 Answer 66 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Brent Hetland
Top achievements
Rank 1
Brent Hetland asked on 04 Sep 2015, 02:34 PM

Hi,

I'm using 2015.1.401 of your controls.

I'm binding the PivotGrid to a List (Of SupplierAlert), where SupplierAlert is my class that represents a business object we work with.

One thing that is great about working with the regular RadGrid is that in the ItemDataBound method I can cast the dataitem into my type and then I can do all my logic using properties of my type.  So for instance I could check a SupplierAlert.AlertLevel or whatever on my object as it bind, and color the cell red if it is a High Alert.

Can I do anything similar to that in the PivotGrid?  In CellDataBound for instance, I want to check my SupplierAlert.HasActionItems property for each detail cell (not any of the aggregates) and if it is true, then I may want to add an img to it or something (don't worry about how to add an img to the cell...  I can figure that out).

Again, is there a method on the server that I can use when the pivotgrid binds, or even after it binds, to do this type of logic?

Thanks,

Brent

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 08 Sep 2015, 01:55 PM
Hi Brent,

The ItemDataBound event is not available with RadPivotGrid because it is not per record control, but rather it is a summarization control in its essence. It uses information from all the records to apply calculations in its core engine and only displays the results in its grid structure. In this sense, you cannot access the items individually and manipulate their data on a singleton basis as with RadGrid.

Therefore, it is not possible to implement item-based logic with RadPivotGrid  as you can achieve with other data visualization controls. RadGrid and RadListView for example provide ItemDataBound and ItemCreated events where you can examine the details of every record. RadPivotGrid is specifically designed for calculating large amount of numeric values and it displays only the result from these summaries.

Maybe you are looking for a RadGrid with a Hierarchy structure integrated with custom aggregate calculations:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/programmatic-hierarchy/defaultcs.aspx

Regards,
Eyup
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
PivotGrid
Asked by
Brent Hetland
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or