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

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

    Posted 10 Nov 2016 Link to this post

    Hi,
    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.

    View.cshtml:

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

  2. Eyup
    Admin
    Eyup avatar
    4079 posts

    Posted 14 Nov 2016 Link to this post

    Hello Rob,

    When using InCell editing mode, the user should first click to cell in order to open it for editing:
    http://demos.telerik.com/aspnet-mvc/grid/editing

    Anything else would be a custom implementation. For example, you can check the attached application for a possible approach with checkbox column.

    Regards,
    Eyup
    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.
  3. Rob
    Rob avatar
    4 posts
    Member since:
    Dec 2012

    Posted 16 Nov 2016 in reply to Eyup Link to this post

    Hi Eyup,
    Thanks for your reply and support.
    I'd like to know if there is any workaround to show dropdownlist as default column type in normal view not in edit only ?
  4. Eyup
    Admin
    Eyup avatar
    4079 posts

    Posted 18 Nov 2016 Link to this post

    Hi Rob,

    You can try using ClientTemplates to achieve this requirement:
    http://docs.telerik.com/aspnet-mvc/helpers/grid/faq#how-to-use-kendo-ui-widgets-inside-grid-client-column-templates

    Regards,
    Eyup
    Telerik by Progress
    Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
Back to Top