asp.net mvc 3 - Div won't refresh with Ajax.ActionLink -
i trying use ajax.actionlink refresh list of items on page. can basic ajax updates working in test page without issue, in particular case i'm not able work.
my index controller , view simple (see below). index view renders list action, items listed , ajaxlinks are. ajaxlinks call "updatestatus" action changes status of item. after happens list should no longer show item return list action.
however, while code executes no errors, page nt update or refresh.
can see problem?
public function index(optional byval status string = "pending") actionresult viewbag.status = status return view() end function public function list(optional byval status string = "pending") actionresult 'code populate model filtered list here' return view(plvm) end function public function updatestatus(byval id integer, byval status string, byval actionstatus string) 'code update status here' db.savechanges() return list(status) end function
index.vbhtml:
@code viewdata("title") = "proposals" layout = "~/views/shared/_layout.vbhtml" end code @* additional render code here *@ <div id="dashboarddetails"> @code html.renderaction("list", "proposals", new {.status = viewbag.status}) end code </div>
list.vbhtml:
@modeltype charitymvc.proposallistviewmodel @code layout = "" end code @* addtional render code here (table tags, etc...) *@ <tbody> @for each item charitymvc.program in model.programs @:<tr id="prop @item.id"> @:<td>@item.proposal.organization.name</td> @:<td>@item.name</td> @:<td><div class="buttons"> @ajax.actionlink("ajax link", "updatestatus", new {.id = item.id, .actionstatus = "tabled", .status = viewcontext.routedata.values("status")}, new ajaxoptions {.updatetargetid = "dashboarddetails"}) @:</div></td> @:</tr> next </tbody> </table>
my best guess/answer far:
it appears have way i'm "nesting" return (returning list function).
if duplicate list() method call inside updatestatus , use following line:
return view("list",plvm)
it works, sort of.
sometimes doesn't return data, blanks out entire list , leaves there , have reload entire page. bug in ajax implementation?
Comments
Post a Comment