.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
Post a Comment