asp.net mvc - MVC4 PartialViews without returning -



asp.net mvc - MVC4 PartialViews without returning -

main view contains @ajax.actionlink links updates div target partialviews. works fine.

@ajax.actionlink("update", "memberinfo", new ajaxoptions() { httpmethod = "get", updatetargetid = "divcurrentview", insertionmode = insertionmode.replace }) <div id="divcurrentview"></div>

question is: when displaying partialview , on click update info , homecoming same partial view reloads data. reloads dropdownlists..etc `

calling partial view:

public partialviewresult memberinfo(){ ....... viewbag.members= new selectlist(_db.members, "id", "text"); homecoming partialview("_memberinfo",model); } [httppost] public partialviewresult memberinfo(informationvm model){ ....... update info //if dont include viewbag 1 time again fail on reload viewbag.members= new selectlist(_db.members, "id", "text"); homecoming partialview("_memberinfo",model); }

instead of homecoming same partialview can show message on screen "data updated" within partial view.?

when define actionlink, can take element gets replaced:

@ajax.actionlink("do something", "_methodname", new ajaxoptions { httpmethod = "post", updatetargetid = "statusmessage", insertionmode = insertionmode.replace, }, new {@class = "text-danger"}) <span id="statusmessage"></span>

this way, message gets loaded span element.

in case, i'd include actionlink within div , replace content of div (including actionlink) partial, time including (different) actionlink.

<div id="divcurrentview"> @ajax.actionlink("update", "memberinfo", new ajaxoptions() { httpmethod = "get", updatetargetid = "divcurrentview", insertionmode = insertionmode.replace }) </div>

partial:

<div id="divcurrentview"> @ajax.actionlink("update", "memberinfo", new ajaxoptions { httpmethod = "post", updatetargetid = "statusmessage", insertionmode = insertionmode.replace}) <span id="statusmessage"></span> </div>

that way, sec (and subsequent) clicks post , utilize different method in controller.

asp.net-mvc asp.net-mvc-4 partial-views

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -