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

Define aggregates for row totals in codebind

4 Answers 37 Views
GridView
This is a migrated thread and some comments may be shown as answers.
invDev
Top achievements
Rank 1
invDev asked on 02 May 2011, 01:24 PM
Hello,

I'm trying to use some row totals in our application just like in your example: ( http://demos.telerik.com/silverlight/#GridView/Totals )

In our scenario the whole grid is built in c# codebind and i tried to adapt the xaml code to c# with no success. Could you give me a short example how to achieve this?

Thanks for your help,

Jonas



4 Answers, 1 is accepted

Sort by
0
invDev
Top achievements
Rank 1
answered on 02 May 2011, 01:28 PM
codebind = codebehind ...
0
Vanya Pavlova
Telerik team
answered on 02 May 2011, 01:35 PM
Hello Jonas,

 

You may use our online documentation, where you can see how to define the AggregateFunctions of different columns in code-behind, following this link.  Regarding the fact in this example are used different DataTemplates I believe that the easiest way to achieve this result is to store the corresponding named DataTemplates within a UserControl's ResourceCollection and then reference it in code-behind as shown below:


this.radGridView.Columns[0].GroupHeaderTemplate = this.Resources["GroupHeaderTemplate"] as DataTemplate;


Please give it a try and let me know if you need any further assistance!

Regards,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
invDev
Top achievements
Rank 1
answered on 02 May 2011, 02:54 PM
Thanks! Now, I've just one last problem: when using the SumFunction instead of the Aggregate- or CountFunction and add this to the DataColumn, the result is an unknown runtime error in a complete different part of the code. The DataType of the column is Int32.

This is the error:

{System.Exception: Schwerwiegender Fehler (Ausnahme von HRESULT: 0x8000FFFF (E_UNEXPECTED))
   bei MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   bei MS.Internal.XcpImports.CreateObjectByTypeIndex(UInt32 typeIndex)
   bei System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
   bei System.Windows.Controls.Primitives.Popup..ctor()
   bei PV.UI.Classes.ModalControl..ctor()
   bei PV.UI.Controls.ModalWindow..ctor(String piInfoTexte, Boolean piBtnYes, Boolean piBtnNo, Boolean piBtnOk, ModalClosing piCallback, String piMode)
   bei PV.UI.Controls.ModalWindow.ShowAppError()
   bei PV.UI.App.Application_UnhandledException(Object sender, ApplicationUnhandledExceptionEventArgs e)
   bei MS.Internal.Error.CallApplicationUEHandler(Exception e)
   bei MS.Internal.Error.GetXresultForUserException(Exception ex)}
0
Accepted
Vanya Pavlova
Telerik team
answered on 02 May 2011, 03:05 PM
Hi Jonas,



I tried to reproduce the problem in a sample project but was not able to. 
Please find it attached and let me know what changes should I make in order to observe the unwanted behavior. Furthermore to avoid any further misunderstandings you may send us in a new support ticket small repro application which we can test by our side.



Kind regards,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
invDev
Top achievements
Rank 1
Answers by
invDev
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or