asp.net mvc - MVC 4 - VIews / Partial Views and Forms - How to update just the partial view on a submit? -


i have mvc 4 view contains form , partial view. main view contains information product , partial view contains images of product.

what have partial view contain it's own form images displayed on. if submit form controller action method, modify model it's based on , have action method refresh partial view, partial view section of main view change , not main view itself? if not, there better way i'm trying do. want update partial view section of main view.

if want update partial view, should retrieve data using ajax call. way call controller return view (in case partial view) need. example:

cshtml:

<div id="mypartialviewdiv">     @{html.renderpartial("mypartialview", model);} </div> 

js:

searchadmin = function () {      var url = "mycontroller/myaction";      $.get(url, { "optionalarg": optionalarg }, function (data) {         $("#mypartialviewdiv").html(data);     }) } 

mycontroller:

public jsonresult myaction(string optionalarg) {     // something...      return this.json(whatiwanttoreturn.tolist(), jsonrequestbehavior.allowget); } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -