Add attributes after viewstate has been saved.

T

Tom Vergote

Hi all,

I have this page with quite a few textboxes which require viewstate ON.
However, i execute some Control.Addatributes on them so the take very much
viewstate space (three times a normal textbox). Those attributes can easily
be readded with every request, so those don't need to be in the viewstate,
only what the user entered in it.

I am looking for a way of having only the value of the textbox saved but not
the attributes i added.

I know Page_Render comes after saving to the viewstate, but can I use that
to add the attributes after the viewstate has been saved? It doesn't work
for me after a few shots and I don't seem to find any info or reference.

Any info would be appreciated

Tom Vergote
MCsomething and another
 
T

Tom Vergote

Saravana,

Thanks for your reply.
if I am not mistaken, the prerender method comes before saving the
viewstate (at least thats what the trace output tells me)

Tom Vergote

Was it not Saravana [MVP] who claimed:
 
S

Saravana [MVP]

Yes, prerender fires before saveviewstate happens. If you just want to
persist only the text value of textbox across postback, then just disable
Viewstate for that controls. Text is a property that does not need to be
stored in ViewState as this is available through the Form collection and the
value will be replaced with the Form value when Postback data is processed
before the Load Event.


--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com
 
T

Tom Vergote

Great,

I wasn't aware that form values get re-loaded to form fields, even if the
viewstate for that control is off.
I'll be switching of more viewstates at the page level from now on, because
apparently you don't need viewstate to reload the form fields with the
entered values.

Thanks a million
Tom

--
Tom Vergote / Developer
ORBID / IT Services
Tramstraat 61 / B-9052 GENT
Tel +32 (0)9 244 99 45 / +32 (0)9 244 99 96
http://www.orbid.be
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top