Version 8 DataForm

Joshua Adams asked on July 9, 2014 15:54

I am using two dataforms on a usercontrol that show label views and edit views, one shows a form with labels, and after a button is clicked, the other shows the control with editable fields. This works, until I want to save my data. It seems to lose the values after postbacks and when I go to save, the button actually wipes out the values that I had. Is there anyway to store those values in session or viewstate so that I can grab them? I tried this briefly, but can't seem to find how I can grab the values before the submit button is clicked. (If I wait till after, the data is wiped out) Also, the Dataform properties are set through properties on the webpart that I have.

Any ideas on how this can be managed?

Correct Answer

Brenden Kehren answered on July 10, 2014 16:40

What I've learned with webparts is you need to load items with every page load. So if you plan to hide/show items on postback, you need to still bind the controls for them to retain their data. Best to put a placeholder on the page and dynamically add the controls I've found.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Joshua Adams answered on July 11, 2014 09:11

Thanks Brenden...It took some playing around with and I finally got a working version. I took the controls and placed them into the front ascx page instead of generating dynamically. Then each pageload I had to set the properties of the controls and it seems to be working. I tried to bind the controls to some properties through the ascx page, hoping that this would eliminate the need to set the properties, but it didn't.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.