asp.net mvc 4 - Ajax.beginform only shows Partial View MVC4 -
when call beginform ajax function, access partialview instead of placing in target refreshs whole view placing code of partialview executed.
these scripts:
bundles.add(new scriptbundle("~/bundles/superbundle").include( "~/scripts/jquery-{version}.js", "~/scripts/jquery-ui-{version}.js", "~/scripts/jquery.unobtrusive*", "~/scripts/jquery.validate*", "~/scripts/jquery.unobtrusive-ajax.js"));
this partialview _busquedadesensores.cshtml
@model ienumerable< recnons.models.getsensorbyclient_result> @using (ajax.beginform("entradasalida", "home", new ajaxoptions { insertionmode = insertionmode.replace, httpmethod = "post", updatetargetid = "entradasalida" })) { <select id="sensores" name="sensores"> @foreach (var item in model) { <option value="@item.id">@item.id</option> } </select> <input type="submit" value="submit" /> }
this homecontroller
[httppost] public actionresult busquedadesensores(int identificador) { viewbag.message = "siga los pasos para completar el proceso..."; retail2entities cl = new retail2entities(); list<getsensorbyclient_result> sensores = cl.getsensorbyclient(identificador,0).tolist(); return partialview("_busquedadesensores",sensores); }
finally here part of index try use ajax function
<ol class="round"> <li class="one"> @using (ajax.beginform("busquedadesensores", "home", new ajaxoptions { insertionmode = insertionmode.replace, httpmethod = "post", updatetargetid = "busquedadesensores" })) { <select id="identificador" name="identificador"> @foreach (var item in model) { <option value="@item.idclient">@item.name</option> } </select> <input type="submit" value="submit" /> } </li> <li id="busquedadesensores "class="two"> </li> <li id="entradasalida "class="three"> </li> </ol>
i have been trying fix hours, 1 thing use of diferent models, model of first select shown diferent 1 managed actionresult busquedadesensores.. ok?
Comments
Post a Comment