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

Hide RadGrid EditForm with FormTemplate when other row is selected

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gabriela
Top achievements
Rank 1
Gabriela asked on 27 Mar 2014, 07:21 PM
Hello all,

I have a radGrid1 showing basic customer information and another RadGrid2 showing customer contacts, when I select a customer in Radgrid1 their contacts are shown in radGrid2, I put a button in RadGrid1 to edit the information of the customer and another button in RadGrid2 to edit the information of the contact, when the button is clicked, the Editform is shown, but if a select another customer the EditForm is still visible in the RadGrid1, and the same happens when I edit a contact in RadGrid2.

What I need is that the EditForm of RadGrid1 close or hide when another row is selected in RadGrid1 or when you click the edit button of RadGrid2 

Sorry about my spelling,
Regards
Gaby Miranda

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Mar 2014, 03:50 AM
Hi Gabriela,

To have only one editform open in a grid, set AllowMultiRowEdit="false" for your grid. In order to have only one edit form open among two grids try the following code snippet.

C#:
//First grid
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.EditCommandName)
  {
      //close edit form of 2nd grid
      RadGrid2.MasterTableView.ClearEditItems();
  }
}
//Second grid
protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.EditCommandName)
  {
      //close editform of 1st grid
      RadGrid1.MasterTableView.ClearEditItems();
  }
}

Thanks,
Princy
0
Gabriela
Top achievements
Rank 1
answered on 28 Mar 2014, 04:36 PM
That works perfectly.

Thanks Princy
Tags
Grid
Asked by
Gabriela
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Gabriela
Top achievements
Rank 1
Share this question
or