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

[Solved] How to save deleted row in database

2 Answers 145 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonathan
Top achievements
Rank 1
Jonathan asked on 02 Dec 2010, 06:04 AM
Hi,

I am using silverlight 4 with Entity Framework 4 self tracking entities as datasource.
I have a grid

<

 

 

telerik:RadGridView Name="gridLegalEntity" ColumnWidth="Auto" AutoGenerateColumns="False" RowIndicatorVisibility="Visible" Deleting="GridLegalEntityDeleting" Deleted="GridLegalEntityDeleted" RowEditEnded="GridLegalEntityRowEditEnded"

 

 

 

SelectionMode="Extended" ActionOnLostFocus="None" CanUserDeleteRows="True" CanUserInsertRows="True" ShowGroupPanel="False" CellValidating="GridLegalEntityCellValidating">

 

 

 

 

<telerik:RadGridView.Columns>

 

 

 

 

<telerik:GridViewDataColumn Header="Long Name" DataMemberBinding="{Binding Entity_Name, Mode=TwoWay}" IsReadOnly="False"/>

 

 

 

 

<telerik:GridViewDataColumn Header="Short Name" DataMemberBinding="{Binding Short_Name, Mode=TwoWay}" IsReadOnly="False"/>

 

 

 

 

<telerik:GridViewDataColumn Header="Nature Of Relevant Interest" DataMemberBinding="{Binding Nature_Relevant_Interest, Mode=TwoWay}" IsReadOnly="False"/>

 

 

 

 

<telerik:GridViewDataColumn Header="Address" DataMemberBinding="{Binding Address, Mode=TwoWay}" IsReadOnly="False"/>

 

 

 

 

<telerik:GridViewDataColumn Header="User" DataMemberBinding="{Binding Update_User}" IsReadOnly="True"/>

 

 

 

 

<telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding Update_Date}" IsReadOnly="True"/>

 

 

 

 

<telerik:GridViewDataColumn Header="Notes" DataMemberBinding="{Binding Notes, Mode=TwoWay}" IsReadOnly="False"/>

 

 

 

 

</telerik:RadGridView.Columns>

 

 

 

 

</telerik:RadGridView>

 



Now when I click on delete button the selected rows are deleted from grid as well as self tracking entities. Because there is no row in self tracking entity with status as 'deleted' I am not able to save the changes in Database.
To the very basic question, The delete command only deletes from Grid and datasource but I cant find any sample where it shows how to store the changes in the database.
All samples I found were of RIAServices but I am using WCF service for communication.

Please help me as soon as possible.

Thanks,
Jono

2 Answers, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 02 Dec 2010, 07:45 AM
Hi Jonathan,

Since you are using WCF service you should invoke custom logic to delete the designated rows. For example, you can use our Deleting event to invoke a routine on your service which will actually delete an entity from the database. The event arguments of the Deleting event will tell you the item/items that are about to be delete - you just have to pass those to your deleting routine and that should be all.


Kind regards,
Milan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Jonathan
Top achievements
Rank 1
answered on 03 Dec 2010, 01:31 AM
Thanks !!
Tags
GridView
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Milan
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or