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

[Solved] Retain values for InsertMode on popup form

1 Answer 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron Hanusa
Top achievements
Rank 1
Aaron Hanusa asked on 04 Nov 2009, 04:05 PM
I am having an issue retaining the values in a popup form if the save of the underlying object is not successful.  Specifically, I am using a custom ObjectDataSource and handling its Inserting event.  I then attempt to create a new object, bind it's value to those found on the popup's controls, and save the object in a try/catch block.

If the save throws an exception, I set a class level variable (_errorOccurred) to true.  Then, I handle the Grid's ItemUpdated event as shown below:

 

 

protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)  
{  
   e.KeepInEditMode = _errorOccurred;  
}  
 


What this does is keeps the popup open, which works great.  However, all of the values are lost, and the user has to re-enter all of the values.

How do I retain the values in the popup in this case?

Thanks!

 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 09 Nov 2009, 11:33 AM
Hi Aaron,

Indeed, in this case, the values will be lost. The reason for this is that the control is rebound. There is no automatic way to preserve the values in the control. To handle this setup, you need to preserve the values entered by the user, and when the control retained in edit mode, you need to restore the values.
I hope this is a suitable approach for you.

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Aaron Hanusa
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or