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

Client-side delete on server side

3 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Julia Shah
Top achievements
Rank 1
Julia Shah asked on 29 Sep 2008, 09:15 PM
Hi,

I have a datagrid that I add/remove rows on the client side and save the results into a database by using following code:

            foreach (GridDataItem item in RadGrid1.Items)  
            {  
                int PrincipalID = Convert.ToInt32(item["PrincipalID"].Text);   
                TextBox box = item.FindControl("txtShare") as TextBox;  
                Share = Convert.ToDecimal(((TextBox)box).Text);  
                InsertShareIntoDB(PrincipalID, Share);  
            }  
 

Adding new rows and updating Share column works fine. What I can't figure out is deleting rows. I am using GridClientDeleteColumn, so when I click on it, the row disappears, as it should. Now on postback, I want to insert into the database only visible (not deleted) rows, but the code above goes through all the rows, even the ones deleted. How can I check on the server-side if a row was deleted?

Thanks,
Julia

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 30 Sep 2008, 02:01 PM
Hi Julia,

Please review this code library for more information how to handle the client-side deleting functionality of RadGrid.

Let us know if you need further directions.


Regards,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Julia Shah
Top achievements
Rank 1
answered on 30 Sep 2008, 05:02 PM
Thank you for your reply. Unfortunately, this is not really what I am looking for.

I am not looking for how to catch the deletes on client side, because I am not using automatic update/delete. I am adding and deleting rows in the datagrid on the client side, and then save the whole grid manually on the server side. How can I tell which rows have been deleted after the postback, on the server side?

Thanks,
Julia
0
Vladimir
Top achievements
Rank 1
answered on 30 Sep 2008, 06:46 PM
Hi,

The grid will raise ItemCommand/DeleteCommand for client-side deleted rows.

Vlad
Tags
Grid
Asked by
Julia Shah
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Julia Shah
Top achievements
Rank 1
Vladimir
Top achievements
Rank 1
Share this question
or