How to keep your data during ajax call in asp.net? -


in asp.net page, using ajax, , want know how keep variable data when doing ajax call. on page load, download lot of information database , display on page. during ajax call, want use data stored in variable, problem is, during ajax call, data goes away, , have re download data again.

is there way keep during ajax call?

in asp.net have many ways this, session["yournamehere"] have vale until sesion closed or viewstate["yournamehere"] have value in page until closed.

some links using viewstate or using sesionstate hope help.

edit

using viewstate.

  1. first put serializable in class.

    [serializable] public class fruits  {     public string apple { get; set; }} 
  2. save value:

    fruits fruit = yourmethod(); //yor method retrive data database* viewstate["fruit"] = fruit;

  3. when you'll use viewstate:

    fruits fruit = viewstate["fruit"]


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -