Link to home
Start Free TrialLog in
Avatar of ravifine
ravifine

asked on

Viewstate changes not persisting while using updatepanel

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
Avatar of ravifine
ravifine

ASKER

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.
how you are saving those in vewstate.
You could also use a session to save your object. i know it work with update panel.

//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;

Advance thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of David Robitaille
David Robitaille
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"I got the solution"
you got it yourself or I helped???
If ravifine, found the solution, please share with us and select it as the solution.

If my anser is the solution, select 24817769.