c# - ASP.NET MVC 5, bootstrap modal popup Not hit Controller method -
i'm using asp.net mvc 5 development. i'm try popup modal data crud operations. i'm try popup modal javascript method. after click link controller method not hit. screen transform dark screen.
view :
<td class="text-right"> <a class="btn btn-info btn-xs" href="javascript:loadedituser(@item.id)"> <i class="fa fa-pencil"></i> </a> </td> <div class="modal fade" id="modaledituser" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> </div>
javascript :
function loadedituser(userid) { debugger; var remoreurl = "/useradmin/index"; $('#modaledituser').modal({ remote: remoreurl }); }
partial view :
this partial view i'm going popup
@using (ajax.beginform("create", "useradmin", new ajaxoptions { updatetargetid = "modaledituser", onsuccess = "usereditsuccess" })) { @html.antiforgerytoken() // web controllers goes here }
controller :
public actionresult edituser(int id) { if (id == 0) { return new httpstatuscoderesult(httpstatuscode.badrequest); } var user = usermanager.findbyid(id); if (user == null) { return httpnotfound(); } var userroles = usermanager.getroles(user.id); return partialview("_edit", new edituserviewmodel() { id = user.id, username = user.username, email = user.email, firstname = user.firstname, lastname = user.lastname, phonenumber = user.phonenumber, roleslist = rolemanager.roles.tolist().select(x => new selectlistitem() { selected = userroles.contains(x.name), text = x.name, value = x.name }) }); }
please me sort out issue. thanks...
try use server url call js
var serverurl = "@url.content("~/")";
then in js call
var remoreurl = serverurl + "useradmin/index";
make sure is
var remoreurl = serverurl + "useradmin/index";
and not
var remoreurl = serverurl + "/useradmin/index";
Comments
Post a Comment