Does a StringBuilder effect Viewstate variable size?

D

darrel

I have a page that hits a database, and then builds a table on the
codebehind size using a string builder.

It's a hefty, complex table. As such, it's a bit large...however, I was a
bit shocked to find that it was a 1.2mb HTML file. I was even more surprised
to find the well over half of the page's markup is the viewstate field's
value. Why is it so [explitive] huge on this page?

For this page, I think I can just turn it off, as there really isn't a need
for the viewstate on this page.

However, I'm going to be building a very similiar table via a usercontrol on
another site. This site needs to preserve the viewstate for a variety of
other things going on with the parent page. Is there a way to turn off just
the usercontron's 'contributeion' to the viewstate value?

-Darrel
 
D

darrel

Why is it so [explitive] huge on this page?

OK, I think I know the answer to that one already. It appears that, indeed,
the entire literal that's holding the string *is* kept in the viewstate
value. I certainly don't need (nor want this) as this page, itself, has no
need to postback on itself, so I'll just shut if off for this page.

And a bit of googling resolved my second issue...you can, indeed, turn of
viewstate down to the control-level. Nice!

-Darrel
 
J

Juan T. Llibre

re:
"And a bit of googling resolved my issue..."

Those words should be engraved, in large letters,
on every developer's monitor.

:)



Juan T. Llibre
ASP.NET MVP
===========
darrel said:
Why is it so [explitive] huge on this page?

OK, I think I know the answer to that one already. It appears that,
indeed,
the entire literal that's holding the string *is* kept in the viewstate
value. I certainly don't need (nor want this) as this page, itself, has no
need to postback on itself, so I'll just shut if off for this page.

And a bit of googling resolved my second issue...you can, indeed, turn of
viewstate down to the control-level. Nice!

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top