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

After update

7 Answers 175 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Amy
Top achievements
Rank 1
Amy asked on 14 Apr 2015, 05:40 PM

I have a raddataform (2014 Q3), and I'm using the ItemUpdating event to run my custom update code (I update a few tables separately); it's working just fine. What I want to do is have the form return to "View" mode after a successful update. I'm sure it's a simple thing but it just stays in "Edit" mode even after a successful update. I have to click "Cancel" to get back to the View Template.

 

How can I make this work as expected? This has to be me just missing something amazingly simple.

 Thanks!!

 Amy

7 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 17 Apr 2015, 10:18 AM
Hello Amy,

I would suggest you to review the online demo below that demonstrates the required functionality:

http://demos.telerik.com/aspnet-ajax/dataform/data-editing/manual-crud-operations/defaultcs.aspx

Give it a test and see if it works for you.

Regards,
Maria Ilieva
Telerik
0
Amy
Top achievements
Rank 1
answered on 17 Apr 2015, 01:17 PM

Thanks  Maria, but that is the first place I looked.

I am not using the same functionality as in the demo. I have to manually add items to the "newValues"  hashtable and am not using the same sort of data access anyway. I do not want to fully re-code a complex page with a grid, a six-pageview multipage, and dataforms.

Are you saying that there is NO WAY to *manually* tell the dataform to go back to View mode after updating? 

0
Maria Ilieva
Telerik team
answered on 22 Apr 2015, 06:54 AM
Hi,

After manually update the "newValues"  hash table you can call "CancelEdit()" for the updated DataRow, that is also demonstrated in the presented demo.This will bring the DataForm to view mode again.

Regards,
Maria Ilieva
Telerik
0
Amy
Top achievements
Rank 1
answered on 22 Apr 2015, 07:23 PM

Thanks but as I stated I don't do the update in that way using a data table, I have to use SqlCommand objects instead.

Do I need to go through this whole operation, to manually create and then access a datarow all to just simply call cancelEdit?

 

 

0
Amy
Top achievements
Rank 1
answered on 22 Apr 2015, 07:25 PM
(All I mean is, having this operation available from the data form itself would be much, MUCH simpler)
0
Maria Ilieva
Telerik team
answered on 27 Apr 2015, 12:31 PM
Hi Amy,

Generally when the data editing ends the DataForm should automatically back to the view mode. In case this is not happening for your application this means that there are some issue in the logic you are using. It will be best if you can send us your page markup as well as the related code behind so that we can revise this logic and advise you further.
Meanwhile you can try to access the DataItem and use its "Edit" property by setting it to "false" and see if this covers your requirements.

Regards,
Maria Ilieva
Telerik
0
Amy
Top achievements
Rank 1
answered on 27 Apr 2015, 06:13 PM

I understand that is how it is supposed to work normally, and that my codebehind was changing the behavior. What I was looking for, was not clearly stated in the documentation as I read it.

"access the DataItem and use its "Edit" property by setting it to "false""


That's exactly what I wanted to know, Maria. Thank you.

Tags
DataForm
Asked by
Amy
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Amy
Top achievements
Rank 1
Share this question
or