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

How to tie the need datasource delete option to Right Click Context Menu in the RadGrid

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Puay Chai Tan
Top achievements
Rank 1
Puay Chai Tan asked on 25 Oct 2010, 01:05 PM
Hi,

Below is our application example URL:
http://test.aptisys.com/UOMSetup.aspx

In all our screens we are using the Right Click Context menu in the Rad Grid with Add, Edit, Delete and Duplicate in the Context Menu. We have implemented the need data source with insert, update and delete command methods. But for the delete, in our old implementation without the need datasource we used the below syntax.

         case "Delete":

                    RadGUOM.MasterTableView.PerformDelete(RadGUOM.Items[radGridClickedRowIndex]);
                    RadGUOM.Rebind();

But after implementing the Need Data source, we cant able to delete the row even we right click the context menu and delete, the delete command method is not fired. We are not sure about how to call the delete command method from right click context menu. Could you please send us some example with right click context menu by right clicking and deleting the grid data implemented with the need data source by calling the Delete command method?

Thanks & Regards

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 26 Oct 2010, 10:36 AM
Hi Puay Chai Tan,

PerformDelete, works only with enabled automatic delete operation.
If you want to fire the DeleteCommand event, please use the  FireCommandEvent method:
Copy Code
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
    int radGridClickedRowIndex = Convert.ToInt32(Request.Form["radGridClickedRowIndex"]);
    switch (e.Item.Text)
    {
        case "Delete":
            RadGrid1.Items[radGridClickedRowIndex].FireCommandEvent("Delete", "");
            RadGrid1.Rebind();
            break;
    }
}

You can see this sample web site where the grid is bound on NeedDataSource event and items are deleted with context menu.

Sincerely yours,
Vasil
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Puay Chai Tan
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or