Friday, May 15, 2009

ASP.NET FormView won’t stay in Edit mode after an update (by default)

The ASP.NET FormView has default behavior such that after you make it update, it changes the mode to ReadOnly. I want to change this behavior so that it stays in edit mode after an update command has been issued.

I don’t consider it very intuitive, but I did find the answer. All you have to  is use the ItemUpdated of the FormView.

protected void formview1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
e.KeepInEditMode = true;
Likewise, there is the same scenario for Insert.
protected void formview1_ItemInserted(object sender, FormViewInsertedEventArgs e)
e.KeepInInsertMode = true;

1 comment:

RRave said...

Invitation to new programming Resources Website

Dear Sir,

I hope you are doing well. I got this email address from one of your contribution web site. I have launched a web site and it is basically aimed C#,JAVA,VB.NET,ASP.NET,AJAX,Sql Server,Oracle,WPF,WCF and etc resources, programming help, articles, code snippet, video demonstrations and problems solving support. I would like to invite you as an author and a supporter.
Looking forward to hearing from you and hope you will join with us soon.

Thank you