This question is locked. New answers and comments are not allowed.
I built the original Silverlight app using WCF RIA services and worked fine.
However, I'm needing to use the app in SharePoint as a web part and, unfortunately, SP2010 doesn't use EF4. Therefore, I had to exposed my database through the standard WCF Data Services (oData). All information is read and displayed correctly. However, values aren't written back to my database. What am I doing wrong?
WCF Service:
MainPage.xaml
MainPage.xaml.cs
(below is called in an onload procedure - again, the records are loaded fine)
I also tried the event below to no avail (which I believe shouldn't need to be called because of the databinding, but maybe I'm do something wrong here):
Thanks,
Joshua
However, I'm needing to use the app in SharePoint as a web part and, unfortunately, SP2010 doesn't use EF4. Therefore, I had to exposed my database through the standard WCF Data Services (oData). All information is read and displayed correctly. However, values aren't written back to my database. What am I doing wrong?
WCF Service:
namespace Checks_Console.Web { public class WCFChecksConsole : DataService<EntitiesContainer> { public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.All); config.MaxExpandDepth = int.MaxValue; config.MaxExpandCount = int.MaxValue; config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } }MainPage.xaml
<telerik:RadGridView Name="rgvCheckRequests" Visibility="Collapsed" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" ShowGroupPanel="False" RowIndicatorVisibility="Visible" Margin="10" CanUserDeleteRows="False" ShowInsertRow="False" CanUserReorderColumns="False" CanUserResizeColumns="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" RowEditEnded="rgvCheckRequests_RowEditEnded" DataLoaded="rgvCheckRequests_DataLoaded"> <telerik:RadGridView.FilterDescriptors> <telerikData:CompositeFilterDescriptor LogicalOperator="Or"> <telerikData:CompositeFilterDescriptor.FilterDescriptors> <telerikData:FilterDescriptor Member="CheckRequestStatus.Name" Operator="IsEqualTo" Value="Requested" IsCaseSensitive="False" /> <telerikData:FilterDescriptor Member="CheckRequestStatus.Name" Operator="IsEqualTo" Value="OnHold" IsCaseSensitive="False" /> <telerikData:FilterDescriptor Member="CheckRequestStatus.Name" Operator="IsEqualTo" Value="Rejected" IsCaseSensitive="False" /> </telerikData:CompositeFilterDescriptor.FilterDescriptors> </telerikData:CompositeFilterDescriptor> </telerik:RadGridView.FilterDescriptors> <telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Path=CheckRequestStatusEnumId}" SelectedValueMemberPath="EnumId" DisplayMemberPath="Name" Header="Status" Width="75" UniqueName="Status" IsFilterable="True" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Consumer.Contact.FirstName}" Header="First Name" Width="120" UniqueName="FirstName" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Consumer.Contact.LastName}" Header="Last Name" Width="120" UniqueName="LastName" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Address.Line1}" Header="Address 1" Width="165" UniqueName="Address1" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Address.Line2}" Header="Address 2" Width="165" UniqueName="Address2" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Address.City}" Header="City" Width="125" UniqueName="City" IsFilterable="False" /> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Path=Address.StateId}" SelectedValueMemberPath="Id" DisplayMemberPath="Abbreviation" Header="State" Width="50" UniqueName="State" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Address.Zip}" Header="Zip" Width="65" UniqueName="Zip" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=VeterinaryClinic.Name}" Header="Veterinary Clinic" Width="220" UniqueName="ClinicName" IsFilterable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Pet.Name}" Header="Pet Name" Width="100" UniqueName="PetName" IsFilterable="False" /> </telerik:RadGridView.Columns> </telerik:RadGridView>MainPage.xaml.cs
void MainPage_Loaded(object sender, RoutedEventArgs e) { svc = new ChecksConsoleService.EntitiesContainer(new Uri(svcURI)); }(below is called in an onload procedure - again, the records are loaded fine)
DataServiceCollection<ChecksConsoleService.CheckRequest> dscCheckRequests = new DataServiceCollection<ChecksConsoleService.CheckRequest>(); dscCheckRequests.LoadCompleted += (o, args) => { rgvCheckRequests.ItemsSource = dscCheckRequests; }; var chkreqs = from cr in svc.CheckRequests .Expand("Consumer") .Expand("Consumer/Contact") .Expand("Address") .Expand("Address/State") .Expand("Pet") .Expand("VeterinaryClinic") .Expand("CheckRequestStatus") select cr; dscCheckRequests.LoadAsync(chkreqs);I also tried the event below to no avail (which I believe shouldn't need to be called because of the databinding, but maybe I'm do something wrong here):
private void rgvCheckRequests_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e) { if (e.EditAction == GridViewEditAction.Cancel) { return; } if (e.EditOperationType == GridViewEditOperationType.Edit) { svc.UpdateObject(e.NewData); } }Thanks,
Joshua