c# - Load partial view in main view on click -


i'm trying partial view load on current view when user clicks link keeps loading partial view rather on same view.

not sure i'm missing.

main view controller

    public partialviewresult monitordetail(monitortype mtype)     {         return partialview("monitordetail", mtype);     } 

main view

<script src="~/scripts/jquery-2.1.1.js"></script> <script src="~/scripts/jquery.unobtrusive-ajax.js"></script>  <p class="lbutton radius">     @ajax.actionlink("sql cluster online ", "monitordetail", "noccon", monitortype.ahssqlcluster, new ajaxoptions() { updatetargetid = "monitordetail" })     <span class="lbutton-addition @(model.sqlclusteronline ? "online" : "offline")">         @(model.sqlclusteronline ? "online" : "offline")     </span></p>  <div id="monitordetail"></div> 

partial view

@model pal.intranet.monitortype <div>     choose @model.tostring() </div> 

also keeps telling me mtype null i'm passing monitortype in actionlink added nullable can try , figure out first issue , work on second.

if displaying partial view, because have not included required files ajax.actionlink work (and performing normal redirect). ensure have included jquery.{version}.js , jquery.unobtrusive-ajax.js

the reason parameter mtype null because not passing value. should

@ajax.actionlink("sql cluster online ", "monitordetail", "noccon", new { mtype = monitortype.ahssqlcluster }, new ajaxoptions() ....) 

Comments