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

to delete a grid row after closing rad window

3 Answers 58 Views
Window
This is a migrated thread and some comments may be shown as answers.
Nazim
Top achievements
Rank 1
Nazim asked on 20 Jan 2011, 10:15 AM
Hi,
My code opens a rad window when a gridbutton, located at a radgrid as a column, is clicked. In the OnClientClose event of the window it deletes the related row in the grid. I put an alert at the end of script which is wiritten to delete  row. I can see that the row is deleted at the grid but when the main window  got focused the row comes back. I think I must delete that row after main window has got focused, but there is no such event. I am sure that there is a simple way to do this. I will be pleasured if you help?
Thanks,

delete function

var table = $find("<%= rGrid.ClientID %>").get_masterTableView().get_element();
       var row = table.rows[rowInd];
       table.deleteRow(rowInd);
        
       var dataItem = $find(row.id);
       if (dataItem)
       {
           dataItem.dispose();
           Array.remove($find("<%= rGrid.ClientID %>").get_masterTableView()._dataItems, dataItem);           
       }

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 25 Jan 2011, 02:39 PM
Hi Nazim,

With such code, you will delete the row on the client. RadGrid however is a databound control and it loads the data from the server, so you need to remove the row from server side. In such scenario, I would suggest to use RadAjaxManager's ajaxRequest() to run a server-side function that would perform the corresponding operation.

Greetings,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Nazim
Top achievements
Rank 1
answered on 25 Jan 2011, 02:57 PM
Hi, I think I could not describe the problem exactly.  I delete related record from db at the winform opened from main page where grid is located. After delete operation  I am closing winfom and at the OnClientClose event I am deleting the row at the grid. The row is being deleted. Ican see it. But when OnClientClose event ends and main page gots focus deleted row is coming back. If I refresh the grid with an ajax request everything is ok, because that row is not in database. But I dont want to go to server to rebind grid.
Thank  you very much,
0
Iana Tsolova
Telerik team
answered on 28 Jan 2011, 10:21 AM
Hello Nazim,

Instead of removing the grid data items, I suggest that you hide them using the set_visible property.

All the best,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Window
Asked by
Nazim
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Nazim
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or