.net - Populate Form from stored session -


i have razor form:

   @html.textboxfor(m=> m.systolicbt, new{@class="riskscoretextbox"})    @html.textboxfor(m=> m.personweight, new{@class="riskscoretextbox"})    @html.textboxfor(m=> m.personweight, new{@class="riskscoretextbox"}) 

then have method retrives object , stores in session.

  [httppost]     public actionresult createprototype(dementiaprototypemodel prototype)     {         session["demensprototype"] = prototype;          return redirecttoaction("riskscore");     } 

and after send method:

  [httpget]     public viewresult riskscore()     {         var prototype = session["demensprototype"];         return view();     } 

here can se object if hoover on prototype, have similar form want populate object info ive stored. how do that?

you can this:

var prototype = session["demensprototype"] dementialprototypemodel; return view(prototype); 

or, this:

[httppost]     public actionresult createprototype(dementiaprototypemodel prototype)     {         return redirecttoaction("riskscore", prototype);     }  [httpget]     public viewresult riskscore(dementiaprototypemodel prototype)     {         return view(prototype);     } 

just make sure view expecting dementialprototypemodel object model.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -