How can I show DropDownList as the default column type in GridView initial loading for all rows ?

2 posts, 0 answers
  1. Rob
    Rob avatar
    4 posts
    Member since:
    Dec 2012

    Posted 10 Nov 2016 Link to this post

    I'd like to know how can I show DropDownList as the default control type for specific column in GridView control on its initial loading instead of showing the default label in each row for specific column.
    I'm using in-cell edit mode and I followed your demos to show DropDownList for specific column by using ClientTemplate and ForeignKey Column Type ..Its working good, However, I'd like to show this DropDownList always for this columns in all rows in GridView initial loading not only when focus on the related cell.



    @(Html.Kendo().Grid<GIWebDemoApp.Models.ViewModels.ProductCategoryViewModel>()<br>    .Name("grid")<br>    .Columns(columns =><br>    {<br>        columns.Bound(p => p.ProductName);<br>        columns.Bound(p => p.Category).ClientTemplate("#=Category.CategoryName#").Width(160);<br>        columns.Bound(p => p.UnitPrice).Width(120);<br>        columns.Command(command => command.Destroy()).Width(90);<br>    })<br>    .ToolBar(toolBar =><br>        {<br>            toolBar.Create();<br>            toolBar.Save();<br>        })<br>    .Editable(editable => editable.Mode(GridEditMode.InCell))<br>    .Pageable()<br>    .Sortable()<br>    .Scrollable()<br>    .HtmlAttributes(new { style = "height:430px;" })<br>    .DataSource(dataSource => dataSource<br>        .Ajax()<br>        .Batch(true)<br>        .ServerOperation(false)<br>        .Events(events => events.Error("error_handler"))<br>        .Model(model =><br>        {<br>            model.Id(p => p.ProductID);<br>            model.Field(p => p.ProductID).Editable(false);<br>        })<br>        .PageSize(20)<br>                .Read(read => read.Action("GetAllProductsAndRelatedCategories", "Product"))<br>                .Create(create => create.Action("AddProductsAndRelatedCategories", "Product"))<br>                .Update(update => update.Action("UpdateProductsAndRelatedCategories", "Product"))<br>                .Destroy(destroy => destroy.Action("RemoveProductsAndRelatedCategories", "Product"))<br>    )<br>)


    <p>public ActionResult Manage()        </p><p>{            </p><p>PopulateCategories();  </p><p>          return View();        </p><p>}</p>

          private void PopulateCategories()<br>        {<br>            var dataContext = new NORTHWNDEntities();<br>            var categories = dataContext.Categories<br>                        .Select(c => new CategoryViewModel<br>                        {<br>                            CategoryID = c.CategoryID,<br>                            CategoryName = c.CategoryName<br>                        })<br>                        .OrderBy(e => e.CategoryName);<br><br>            ViewData["categories"] = categories;<br>      <br>        }



  2. Eyup
    Eyup avatar
    4081 posts

    Posted 14 Nov 2016 Link to this post

    Hi Rob,

    I've already replied to your query to your other thread:

    I suggest that we continue our conversation on the mentioned thread.

    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Back to Top