Viewstate in custom webparts not working at all?

Mark McKenna asked on August 19, 2015 17:05

If I put a checkbox (or any standard control) on a blank aspx page, and a button to postback, the value of the control is saved. This is pretty standard viewstate stuff.

If I do exactly the same, but into a custom abstract (otherwise blank) webpart, the button posts back, but the viewstate does not seem to be carried over - the checkbox is unselected if selected, the textbox is blank despite having data in before postback, etc etc.

I've messed about with enabling view state, modes, etc but I think this might be something I've accidentally turned off in Kentico settings somewhere maybe? Also 'Disable view state' is definitely not checked in the webpart properties :)

Anyone point me in the right direction?

Thanks!

Correct Answer

Matthew Sandstrom answered on August 20, 2015 15:36

Hi Mark,

As you mentioned in our support ticket, the issue turned out to be from a duplicate div id.

I am just mentioning this for the sake of anyone with a similar issue who finds this post.

Have a great day!

Best regards,

Matthew Sandstrom Support Engineer

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on August 19, 2015 18:24

Have you checked any of the containers holding the webpart i.e.: webpart zone or template properties? You can turn off viewstate there as well and it does the same for the child controls.

1 votesVote for this answer Mark as a Correct answer

Mark McKenna answered on August 20, 2015 09:21

Hi Brenden,

As I have modified the Kentico-standard Ecommerce template this could well be the case. However I can't seem to find the global/template/webpart view state options? Could you point me in the right direction?

Thanks,

Mark

0 votesVote for this answer Mark as a Correct answer

Mark McKenna answered on August 20, 2015 15:40

Haha, yes - genuinely was going to reply to this ticket but forgot.

Always check the obvious first - incompetence!

There was also a form tag (from a template we are using) which also didn't help.

Many thanks for your replies here and on support :)

0 votesVote for this answer Mark as a Correct answer

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