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

Close User Control (Edit Form) on edit item command

2 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amjad
Top achievements
Rank 1
Amjad asked on 28 Nov 2011, 12:33 PM
Hello telerik members;

Pease can you help on the below;

I have a grid with an edit item command that loads a user control form like:http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx 
I need to close the edit form (user control) when the user clicks back on the edit item command just like clicking cancel button on the user control. 

Best Regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 30 Nov 2011, 12:16 PM
Hello Amjad,

Try handling the grid ItemCommand server-side event as below:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.EditCommandName && e.Item.Edit)
    {
        e.Canceled = true;
        e.Item.OwnerTableView.OwnerGrid.EditIndexes.Clear();
        e.Item.OwnerTableView.OwnerGrid.Rebind();
    }
}


All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Amjad
Top achievements
Rank 1
answered on 30 Nov 2011, 12:23 PM
Thanks Worked fine for me
Tags
Grid
Asked by
Amjad
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Amjad
Top achievements
Rank 1
Share this question
or