i have create view displays value along form. when submit have value available.
in controller have this:
public actionresult create(guid? id) { if (id == null || id == guid.empty) return view(); viewbag.registrationverificationid = id; var email = (from rv in _db.registrationverification rv.registrationverificationid == id select rv.email).firstordefault(); viewbag.email = email; return view(); } [httppost] [validateantiforgerytoken] public actionresult create(profile profilemodel) { if (modelstate.isvalid) { var emailvalue = @viewbag.email; //... } //... } my view looks this:
@model publicationsystem.model.profile @{ viewbag.title = "create"; layout = "~/views/shared/_layout.cshtml"; } <h2>create</h2> @using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>profile</h4> <hr /> @html.validationsummary(true) @html.hiddenfor(model => model.profileid) <div class="form-group"> @html.label("email provided", htmlattributes: new {@class = "control-label col-md-2"}) <div class="col-md-10"> @viewbag.email </div> </div> <div class="form-group"> @html.labelfor(model => model.salutation, htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.salutation) @html.validationmessagefor(model => model.salutation) </div> </div> .... } what best way store value between response , postback?
session["email"] = email; this store value between response , postback. let me know if looking for.
Comments
Post a Comment