Move ASP.Net ViewState to SQL Server(geekzilla.co.uk)

submitted by marshp3marshp3(965) 3 years, 9 months ago

ViewState is a great feature, but it can get really bloated with data, especially if you have loads of controls on a page, repeaters etc. You could think about setting enable viewstate to false, but you'll need it for posting pages back. This tutorial moves the viewstate to a SQL database, by implementing a simple class that all your pages will inherit from.

2 comments |category: |Views: 463

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by chrcar01chrcar01(560) 3 years, 9 months ago 0

"You could think about setting enable viewstate to false, but you'll need it for posting pages back"

That's not true.

You can kill viewstate for your whole app, and postbacks work fine.

The only time they don't is if you postback and present the user with the same page they just posted, then the controls would not be prepopulated, so it depends on the behavior of your app.

Reply

posted by DavidPDavidP(0) 3 years, 9 months ago 0

In the "Save" method why are they creating the hidden input element with the viewstate? Seems very redundant.

Reply

information Login or create an account to comment on this story