Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

persisting ViewState

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cfps.Christian - 14 Dec 2007 19:13 GMT
I have a web usercontrol on the form that dynamically builds itself
and then when an item has been clicked it will allow me to get the
object at the selected index.  The problem I'm having is that I need
the items to persist in viewstate so I can pull them out but when a
button on the main form is clicked all the information stored in the
viewstate is lost.

I've tried session too and it won't let me do anything with it at all
(object is set to instance...)
Scott Roberts - 14 Dec 2007 19:25 GMT
>I have a web usercontrol on the form that dynamically builds itself
> and then when an item has been clicked it will allow me to get the
[quoted text clipped - 5 lines]
> I've tried session too and it won't let me do anything with it at all
> (object is set to instance...)

It's unlikely that the viewstate is "lost". What's more likely is that you
are either not re-creating the usercontrol on post-back (so there are no
controls to be updated with viewstate info), or you are re-creating it
*after* the page controls have been updated with viewstate information
(Page_Init).

Dynamically added controls are not created automatically by asp.net
(obviously), but they *are* updated with viewstate info, provided they exist
when the "viewstate update" occurs (during PageInit).

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.