asp.net mvc - Show URL with ID in MVC -
i new mvc still learning way. submitting form,and need grab info of 1 of textboxes , pass url. routeconfig default know have route correctly, controller:
acceptverbs(httpverbs.post)] public actionresult verify(string verificationstring) { homecoming view(); }
and view has this:
@using(html.beginform("verify", "status", formmethod.post)) { @html.antiforgerytoken() @html.textboxfor(m => m.verificationcode, new { @name="verificationid", @class = "form-control", @maxlength = "18", @required="required" }) }
i don't know how pass variable in url shows /status/verify/verificationstring(textbox data). how can this?
edit: routeconfig
routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional }
edit: fullview
@model lsfverif.models.statusmodel <div class='form-group' style="text-align:center"> @using(html.beginform("verify", "status", formmethod.post)) { @html.antiforgerytoken() @html.validationsummary(true) @html.textboxfor(m => m.email, new { @class = "form-control", @type="email", @placeholder = "email", @maxlength = "100", @required="required" }) @html.textboxfor(m => m.verificationcode, new { @name="verificationcode", @class = "form-control", @placeholder = "codigo", @maxlength = "18", @required="required" }) <button class='btn-lg btn-primary' type='submit'>verify</button>
}
@using (html.beginform("verify", "status", formmethod.post)) { @html.antiforgerytoken() @html.textboxfor(m => m.verificationcode, new { @class = "form-control", @maxlength = "18", @required = "required" }) <input type="submit" value="submit" /> } , [httppost] public actionresult verify(string verificationcode) { homecoming redirecttoactionpermanent("vierified", "status", new { id = verificationcode }); } [httpget] public actionresult vierified(string verificationcode) { homecoming view("vierified"); }
asp.net-mvc
No comments:
Post a Comment