I have a DataGrid in a Silverlight application. This application is using RIA Data Services. My code looks like the following:
<riaControls:DomainDataSource AutoLoad="True"
d:DesignData="{d:DesignInstance my1:Order, CreateList=true}" Height="0"
LoadedData="orderDomainDataSource_LoadedData" Name="orderDomainDataSource"
QueryName="GetOrdersQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:OrderDomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<sdk:DataGrid AutoGenerateColumns="True" Height="202" Name="ordersDataGrid"
HorizontalAlignment="Left"
ItemsSource="{Binding ElementName=orderDomainDataSource, Path=Data}">
</sdk:DataGrid>
<Button Content="Delete Order" Height="23" Name="deleteButton"
Width="90" Grid.Row="1" HorizontalAlignment="Left" Margin="102,8,12,0"
Click="deleteButton_Click" />
In my code-behind, I have
private void deleteButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (HtmlPage.Window.Confirm("Are you sure you want to delete this order?") == true)
{
}
}
My problem is, I can't figure out how to delete the record from my data source. How do I delete the record that is currently selected in my DataGrid?
Thank you