Note that there are some explanatory texts on larger screens.

plurals
  1. PODropdownList in Popup in Grid KendoUI dont show data
    text
    copied!<p>i have a problem with a DropdownList control. i have a Grid with a popup edditing and when i show a popup the DropDownList doesnt show any data, im using MVC4 and KendoUI controls</p> <p>this is the code.</p> <p>The Grid.</p> <pre><code>@(Html.Kendo().Grid&lt;CashControl.Models.Usuario&gt;() .Name("grid") .Columns(columns =&gt; { columns.Bound(p =&gt; p.nombre).Width(100); columns.Bound(p =&gt; p.nombreUsuario).Width(100); columns.Bound(p =&gt; p.email).Width(100); columns.Command(command =&gt; { command.Edit(); command.Destroy(); }).Width(160); }) .ToolBar(toolbar =&gt; toolbar.Create()) .Editable(editable =&gt; editable.Mode(GridEditMode.PopUp).TemplateName("DropDownListUsuarios")) .Pageable() .Sortable() .Scrollable() .HtmlAttributes(new { style = "height:430px;" }) .DataSource(dataSource =&gt; dataSource .Ajax() .PageSize(20) .Events(events =&gt; events.Error("error_handler")) .Model(model =&gt; { model.Id(p =&gt; p.idUsuario); }) .Create(update =&gt; update.Action("EditingInline_Create", "Grid")) .Read(read =&gt; read.Action("UsuariosRead", "Configuracion")) .Update(update =&gt; update.Action("EditingInline_Update", "Grid")) .Destroy(update =&gt; update.Action("EditingInline_Destroy", "Grid")) ) ) </code></pre> <p>The PopUp</p> <pre><code>&lt;div class="demo-section" style="width: 250px;"&gt; &lt;h2&gt;Products&lt;/h2&gt; @(Html.Kendo().DropDownList() .Name("products") .HtmlAttributes(new { style = "width: 250px" }) .DataTextField("nombre") .DataValueField("idnombre") .DataSource(source =&gt; { source.Read(read =&gt; { read.Action("UsuarioRead", "Configuracion"); }); }) ) &lt;/div&gt; &lt;style scoped&gt; .demo-section { width: 250px; margin: 35px auto 50px; padding: 30px; } .demo-section h2 { text-transform: uppercase; font-size: 1.2em; margin-bottom: 10px; } &lt;/style&gt; </code></pre> <p>and the Controller.</p> <pre><code>public ActionResult UsuarioRead([DataSourceRequest] DataSourceRequest request) { IQueryable&lt;Usuario&gt; products = CashControl.Usuario; var rest = products.Select(n =&gt; new { idUsuario = n.idUsuario, nombre = n.nombre, nombreUsuario = n.nombreUsuario, email = n.email }); DataSourceResult result = rest.ToDataSourceResult(request); return Json(result, JsonRequestBehavior.AllowGet); } </code></pre> <p>and this is the JSON result</p> <pre><code>{"Data":[{"idUsuario":1,"nombre":"Eduardo","nombreUsuario":"Brakyo","email":"eduardomeji@gmail.com"}],"Total":1,"AggregateResults":null,"Errors":null} </code></pre> <p>i hope anyone can helpme. Tankx :D</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload