开发者

ASP.NET ObjectDataSource UpdateMethod Exception Handling

I have a GridView control on my page which is connected with ObjectDataSource where TypeName="BLL.MyLogic" DataObjectTypeName="BLL.MyObject" UpdateMethod="MyUpdateMethod".

The update in MyUpdateMethod is conditional which I am checking the conditions before _datacontext.submitchanges(). Depending on my check I throw exceptions like ("not unique") or ("no appropiate logic found") etc开发者_如何学Python. I am catching these exceptions at page level via OnUpdated="MyDataUpdated" of my ObjectDataSource.

These operations just work fine. Problem is after the process is done and even in the case of "exception occured" the GridView gets reloaded and editindex = -1 (initiated). Even if I manually retrieve the editindex and make it editable the form data (data input by user) in the edittemplate gets wipped away. ViewState doesnt work here.

What is the work around to this situation ?

Thanks in advance.


Have you tried setting the GridViewUpdatedEventArgs.KeepInEditMode property to true in your RowUpdated event handler?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜