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

Radgrid - How do I close the OTHER edit forms?

2 Answers 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 13 Jul 2011, 01:13 AM
I have a RadGrid where each row has an Edit button that opens an edit form that is in a Web UserControl.

These work fine. Say I edit row 1, but then click on the Edit button on Row 2, Row 1 closes as expectd.

However, If I click on say row 1 but then click the Add New Record link, Row 1 stays open along with a new blank form for the row I am adding.

When Adding a new record, how do I close all other edit forms?

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Jul 2011, 05:54 AM
Hello Brad,

Try the following code snippet to achieve the scenario.
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
  {
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.OwnerTableView.IsItemInserted )
          {
               RadGrid1.MasterTableView.ClearEditItems();
          }
  }
Thanks,
Shinu.
0
Brad
Top achievements
Rank 1
answered on 13 Jul 2011, 06:05 AM
Oh, so simple when you know. Thanks Shinu. That worked a treat.

I put it in ItemCommand and it seemed to do the trick.

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
       {
           if (e.CommandName == Telerik.Web.UI.RadGrid.InitInsertCommandName)
           {
 
               RadGrid1.MasterTableView.ClearEditItems();


Brad
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Brad
Top achievements
Rank 1
Share this question
or