asp.net mvc - I want to open a new window or tab on click of button using MVC -
[httppost] public actionresult index(debuggerindexformholder holder) { var result = _debuggerindexformprocessor.process(holder.debuggerindexform, modelstate); if (result.issuccess) { return redirecttoaction("item", new { id = result.sessionid }); } } [httpget] public actionresult item(string id, string inputid) { var model = _debuggersessionviewmodelbuilder.build(id, inputid); return view(model); // opens required view in same window }
html code
<button id="submit" type="submit" data-loading-text="loading..." class="btn btn-primary">debug it!</button>
actionresult "index" called , in turns calls actionresult "item" , passing session id action result "item", fills model on session id basis calls view , need open view in different window using same session id. can please me ? thanks
that's not can control server side code. need add aformtarget="_blank"
attribute button
.
<button id="submit" type="submit" formtarget="_blank" data-loading-text="loading..." class="btn btn-primary">debug it!</button>
whether opens new tab or new window dependent on user's browser settings.
Comments
Post a Comment