Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Add attributes after viewstate has been saved.

Reply
Thread Tools

Add attributes after viewstate has been saved.

 
 
Tom Vergote
Guest
Posts: n/a
 
      01-28-2004
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


 
Reply With Quote
 
 
 
 
Saravana [MVP]
Guest
Posts: n/a
 
      01-28-2004
Write your code in Page_Prerender method .

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



"Tom Vergote" <tom.vergote@[spamtrap]orbid.be> wrote in message
news:4017887a$0$324$...
> 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
>
>



 
Reply With Quote
 
 
 
 
Tom Vergote
Guest
Posts: n/a
 
      01-28-2004
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:

> Write your code in Page_Prerender method .
>
> --
> Saravana
> Microsoft MVP - ASP.NET
> www.extremeexperts.com
>
>
>
> "Tom Vergote" <tom.vergote@[spamtrap]orbid.be> wrote in message
> news:4017887a$0$324$...
>> 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
>>
>>


 
Reply With Quote
 
Saravana [MVP]
Guest
Posts: n/a
 
      01-29-2004
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



"Tom Vergote" <> wrote in message
news llyhatesspam.be...
> 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:
>
> > Write your code in Page_Prerender method .
> >
> > --
> > Saravana
> > Microsoft MVP - ASP.NET
> > www.extremeexperts.com
> >
> >
> >
> > "Tom Vergote" <tom.vergote@[spamtrap]orbid.be> wrote in message
> > news:4017887a$0$324$...
> >> 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
> >>
> >>

>



 
Reply With Quote
 
Tom Vergote
Guest
Posts: n/a
 
      01-29-2004
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

"Saravana [MVP]" <> wrote in message
news:...
> 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
>
>
>
> "Tom Vergote" <> wrote in

message
> news llyhatesspam.be...
> > 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:
> >
> > > Write your code in Page_Prerender method .
> > >
> > > --
> > > Saravana
> > > Microsoft MVP - ASP.NET
> > > www.extremeexperts.com
> > >
> > >
> > >
> > > "Tom Vergote" <tom.vergote@[spamtrap]orbid.be> wrote in message
> > > news:4017887a$0$324$...
> > >> 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
> > >>
> > >>

> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not add to/modify dropdown list after datasource has been load =?Utf-8?B?TWVyZGFhZA==?= ASP .Net 5 11-07-2006 02:32 PM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM
I need help I has been over 6 months since I've been able to do the system check for updates Marc Computer Support 8 07-25-2005 07:04 PM
DropDownList: possible to add new rows after the DataSource has been set? Jim Bancroft ASP .Net 4 01-06-2005 08:11 AM
Can not add/modify dropdown liat after datasource has been loaded =?Utf-8?B?TWVyZGFhZA==?= ASP .Net 0 10-20-2004 08:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57