We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Viewstate changes not persisting while using updatepanel

ravifine
ravifine asked
on
Medium Priority
2,012 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
Comment
Watch Question

Author

Commented:
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.
David RobitailleAnalyst Programmer

Commented:
how you are saving those in vewstate.
You could also use a session to save your object. i know it work with update panel.

Author

Commented:

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

Author

Commented:
Advance thanks for your help
Analyst Programmer
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
David RobitailleAnalyst Programmer

Commented:
"I got the solution"
you got it yourself or I helped???
David RobitailleAnalyst Programmer

Commented:
If ravifine, found the solution, please share with us and select it as the solution.

If my anser is the solution, select 24817769.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.