[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Viewstate changes not persisting while using updatepanel

Posted on 2009-07-09
9
Medium Priority
?
1,926 Views
Last Modified: 2013-11-07
When I update Viewstate runtime and saving, it is not keeping the changes in viewstate   after I do partical postback using ajax update panel control
0
Comment
Question by:ravifine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
9 Comments
 

Author Comment

by:ravifine
ID: 24817166
Hi,
it's urgent. Can any one suggest me.

Here is my scenario

I have public property which contains some object. I'm saving that object in viewstate. When I use update panel and doing partial postback, the changes which I made to  my public property are not persisting in viewstate.
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24817473
how you are saving those in vewstate.
You could also use a session to save your object. i know it work with update panel.
0
 

Author Comment

by:ravifine
ID: 24817607

//this is my property
private Dictionary<string, List<Event>> EventsDictionary
                  {
                        get
                        {
                              if (ViewState["EventsDictionary"] != null)
                              {
                                    return (Dictionary<string, List<Event>>)ViewState["EventsDictionary"];
                              }
                              else
                              {
                                    return null;
                              }
                        }
                        set
                        {
                              ViewState["EventsDictionary"] = value;
                        }
                  }

// this is my code which modifies  EventsDictionary object and keeping in viewstate

                              Dictionary<string, List<Event>> eventDictionary = EventsDictionary;
                              Dictionary<string, string[]> weekEvents = WeekEvents;
                              ScheduleManager.CopyDayEventsToAnotherDay(ref eventDictionary);// here I'm updating my EventDictionary object.
                              EventsDictionary = eventDictionary;
                              eventDictionary = null;

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ravifine
ID: 24817614
Advance thanks for your help
0
 
LVL 18

Accepted Solution

by:
David Robitaille earned 1000 total points
ID: 24817769
hummm... it work without the update panel?
If yes, make sure the update panel dont generate an error that block the update.
Also, i thnik the way the update panel work, it just update the controls that are inside of it. since the EventsDictionary is not inside of it (and i dont think it can), it is not persisted...
try to replace the ViewState["EventsDictionary"] with Session["EventsDictionary"]
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24834276
"I got the solution"
you got it yourself or I helped???
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24834303
If ravifine, found the solution, please share with us and select it as the solution.

If my anser is the solution, select 24817769.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question