This question is locked. New answers and comments are not allowed.
I have telrik grid with another grid in rowdetails template.I have following columns
Description,
OrderAmount(Qty),
TempPrice,
CurrencyCode
Total
Total Column is the multiplication of the OrderAmount(Qty) and TempPrice.User can update TempPrice at runtime and based on the new temp price , total must be updated.
I am using Ado.net Entity framework with domain service as a data model. To calculate the total , i have created partial class with following properties as i do not have permission to update entity model.
Description,OrderAmount(Qty) and CurrencyCode are coming ado.net entity framework.While TempPrice and Total are defined in the partial class.
Now my problem is Total is not updated when TempPrice in a column is updated. Following is the code
Grid
Binding the child grid
This is how my partial class looks.Main class is defined in ado.net entity framework
Please help me.
Description,
OrderAmount(Qty),
TempPrice,
CurrencyCode
Total
Total Column is the multiplication of the OrderAmount(Qty) and TempPrice.User can update TempPrice at runtime and based on the new temp price , total must be updated.
I am using Ado.net Entity framework with domain service as a data model. To calculate the total , i have created partial class with following properties as i do not have permission to update entity model.
Description,OrderAmount(Qty) and CurrencyCode are coming ado.net entity framework.While TempPrice and Total are defined in the partial class.
Now my problem is Total is not updated when TempPrice in a column is updated. Following is the code
Grid
<telerikGridView:RadGridView Name="grdOrders" Grid.Row="0" ShowGroupPanel="False" IsReadOnly="False" MinWidth="550"<br> AutoGenerateColumns="False" CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" <br> CanUserResizeColumns="False" IsFilteringAllowed="False" HorizontalAlignment="Stretch"<br> VerticalAlignment="Top" SelectionMode="Single" LoadingRowDetails="grdOrders_LoadingRowDetails" RowDetailsVisibilityChanged="grdOrders_RowDetailsVisibilityChanged" ><br><br> <telerikGridView:RadGridView.Resources><br> <Helper:ArithmeticConverter x:Key="arithmeticconverter"></Helper:ArithmeticConverter><br> </telerikGridView:RadGridView.Resources><br><br> <telerikGridView:RadGridView.Columns><br> <telerikGridView:GridViewToggleRowDetailsColumn/><br> <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding OrderNumber}" Header="Order Number" Background="HotPink" /><br> </telerikGridView:RadGridView.Columns><br> <telerikGridView:RadGridView.RowDetailsTemplate><br> <DataTemplate><br> <Grid VerticalAlignment="Stretch" ShowGridLines="True" ><br> <Grid.RowDefinitions><br> <RowDefinition Height="Auto"/><br> <RowDefinition Height="Auto"/><br> </Grid.RowDefinitions><br> <Grid.ColumnDefinitions><br> <ColumnDefinition /><br> </Grid.ColumnDefinitions><br><br> <telerikGridView:RadGridView Name="radgrdOrderDetails" <br> ShowColumnFooters="True"<br> ShowGroupPanel="False" <br> AutoGenerateColumns="False" <br> IsFilteringAllowed="False" <br> CanUserFreezeColumns="False"<br> RowIndicatorVisibility="Collapsed" <br> CanUserResizeColumns="False" <br> HorizontalAlignment="Stretch" <br> <br> VerticalAlignment="Top" Grid.Row="0"><br><br> <telerikGridView:RadGridView.Columns><br> <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Description, Mode=TwoWay}" MinWidth="200" Header="Description" IsReadOnly="True" IsVisible="True"/><br> <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding OrderAmount,Mode=TwoWay}" MinWidth="100" Header="Amount" IsReadOnly="True" IsVisible="True"/><br> <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding TempPrice,Mode=TwoWay}" MinWidth="100" Header="price" IsReadOnly="false" IsVisible="true"/><br> <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding CurrencyCode,Mode=TwoWay}" MinWidth="100" Header="CurrencyCode" IsReadOnly="True" /><br><br> <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Total, Mode=TwoWay}" MinWidth="100" Header="Total" IsReadOnly="True" ><br> <telerikGridView:GridViewDataColumn.AggregateFunctions><br> <telerikData:SumFunction Caption="Sum : "></telerikData:SumFunction><br> </telerikGridView:GridViewDataColumn.AggregateFunctions><br> </telerikGridView:GridViewDataColumn><br><br> </telerikGridView:RadGridView.Columns><br> </telerikGridView:RadGridView><br> </Grid><br> </DataTemplate><br> </telerikGridView:RadGridView.RowDetailsTemplate><br><br> </telerikGridView:RadGridView>Binding the child grid
private void grdOrders_LoadingRowDetails(object sender, Telerik.Windows.Controls.GridView.GridViewRowDetailsEventArgs e)<br> {<br> objDetailGrid = (RadGridView)e.DetailsElement.FindName("radgrdOrderDetails");<br> vw_SelectOrderWithInvoice objCurrentItem = (vw_SelectOrderWithInvoice)e.Row.DataContext;<br> objDetailGrid.ItemsSource = OrderDetails.Where(ord => ord.ID == objCurrentItem.ID);<br>} <br>This is how my partial class looks.Main class is defined in ado.net entity framework
public partial class vw_SelectOrderDetails : EntityObject<br> {<br><br><br> /// <summary><br> /// No Metadata Documentation available.<br> /// </summary><br> // [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]<br> [DataMemberAttribute()]<br> public global::System.Decimal? Total<br> {<br> get<br> {<br><br> if (_Total == null)<br> {<br> _Total = Price * OrderAmount;<br> }<br> return _Total;<br> }<br> set<br> {<br> if (Total != value)<br> {<br> OnTotalChanging(value);<br> ReportPropertyChanging("Total");<br> _Total = StructuralObject.SetValidValue(value);<br> ReportPropertyChanged("Total");<br> OnTotalChanged();<br> }<br> }<br> }<br> private global::System.Decimal? _Total;<br> partial void OnTotalChanging(global::System.Decimal? value);<br> partial void OnTotalChanged();<br><br> [DataMemberAttribute()]<br> public global::System.Decimal? TempPrice<br> {<br> get<br> {<br> if (_TempPrice == null)<br> {<br> this._TempPrice = Price;<br> }<br> return _TempPrice;<br> }<br> set<br> {<br> if (_TempPrice != value)<br> {<br> OnTempPriceChanging(value);<br> ReportPropertyChanging("TempPrice");<br> _TempPrice = StructuralObject.SetValidValue(value);<br> ReportPropertyChanged("TempPrice");<br> OnTempPriceChanged();<br> Price = _TempPrice;<br> Total = _TempPrice * OrderAmount;<br> ReportPropertyChanged("Total");<br> }<br> }<br> }<br> private global::System.Decimal? _TempPrice;<br> partial void OnTempPriceChanging(global::System.Decimal? value);<br> partial void OnTempPriceChanged();<br><br><br><br><br> }Please help me.