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

[Solved] How to Make Insert/Edit's EditForm Not to Appear Together in a Grid?

2 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BUbu Chan
Top achievements
Rank 1
BUbu Chan asked on 20 Jan 2010, 04:56 AM
Version:
Q2 2009 NET35
Senario:
If user click "Add New Record" in midst of editing a row, how to close the preview editform (Edit Mode, cancel all edit transcation) and open a new editform (Insert Mode) instead of allow 2 editforms appear together in the grid?

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 20 Jan 2010, 06:29 AM
Hi,

Try the code snippet below to switch from  Update to Insert mode and Insert to Update mode.

C#
private void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
  RadGrid grid = (source as RadGrid); 
  if(e.CommandName == RadGrid.InitInsertCommandName) 
  { 
   grid.MasterTableView.ClearEditItems(); 
  } 
  if(e.CommandName == RadGrid.EditCommandName) 
  { 
   e.Item.OwnerTableView.IsItemInserted = false
  } 


Thanks,
Princy
0
BUbu Chan
Top achievements
Rank 1
answered on 20 Jan 2010, 10:50 AM
Works Great! Thanks :)
Tags
Grid
Asked by
BUbu Chan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
BUbu Chan
Top achievements
Rank 1
Share this question
or