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

Closing editForm from outside the Grid

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 05 Jul 2012, 09:34 AM
Hello,

I have a button outside of the Grid which should close any opened insert and edit forms. For insert forms this works without any problem:

if (m_grid.MasterTableView.IsItemInserted)
{
    GridEditFormInsertItem insertItem = (GridEditFormInsertItem)m_grid.MasterTableView.GetInsertItem();
    insertItem.FireCommandEvent("PerformInsert", String.Empty);
}

But for the edit item it doesn't work correctly:

if (m_grid.EditItems.Count > 0)
{
     m_grid.EditItems[0].FireCommandEvent("Update", String.Empty);
}

The GridSaveCommand event is called, but when I try to access my EditForm, it doesn't get found when updating (control will be null). When inserting, it works perfectly. What am I doing wrong when updating?

MyControl control = (MyControl )e.Item.FindControl("MyControl");

Thanks!

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jul 2012, 10:18 AM
Hello,

Try the following code to close edit form in external button click.
C#:
protected void Button1_Click(object sender, EventArgs e)
{
 RadGrid1.MasterTableView.ClearEditItems(); 
}

Thanks,
Shinu.
Tags
Grid
Asked by
JP
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or