asp.net mvc - How to position a partial view in a page when load dynamically after postback -
i new in mvc ask 2 noob questions , are
1) how load partial view dynamically after postback. suppose have button in main view , when user click want load partial view dynamically after postback. know how load partial view dynamically using jquery want know how can load partial view after postback in main view without using jquery.
2) when load view dynamically jquery can capture view rendered html , set or position html in in main view want know how position or adding partial view html after postback. @ possible without using jquery?
in asp.net webform can load user control dynamically after postback , can add usercontrol in page without using jquery. same kind of flexibility there in mvc or restricted.
please give answer point wise example or sample code. thanks
for first question can use different techniques, here sample
[httppost] public actionresult foo() { viewbag.showpartial = true; return view(); }
in view
@if (viewbag.showpartial) { html.partial("_mypartial"); }
for second question suggest read little more asp.net mvc, , postback means nothing in asp.net mvc, post request , request on, , can add ever want view
one other sample
in view
@if (request.requesttype == "post") { // ever want }
Comments
Post a Comment