This is a migrated thread and some comments may be shown as answers.

Editing with DropDownList

1 Answer 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 31 Jul 2013, 10:30 AM
Hello,
I'm going further in my KendoUI discovery... I wish to have a DropDownList while editing a cell on a certain column

my grid is :

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <%: Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(x => x.IDUtente);
        columns.Bound(x => x.Nominativo);
        columns.Bound(x => x.Societa);
        columns.Bound(x => x.Filiale);
        columns.Bound(x => x.Ruolo);
        columns.Bound(x => x.IDStato).Hidden();
        columns.Bound(x => x.Stato).ClientTemplate("StatoID");
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Groupable()
   // .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax().Model(model => model.Id(p => p.IDUtente))
        .ServerOperation(false)
        .Read(read => read.Action("GetListaUtenti", "Administration")
        )
    )
%>
</asp:Content>

and I've created an ascx called StatoID with

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<int>" %>

<%:@(Html.Kendo().DropDownListFor(m => m).BindTo(new List<SelectListItem>() {
              new SelectListItem() {
                  Text = "Enabled",
                  Value = "1"
              },
              new SelectListItem() {
                  Text = "Disabled",
                  Value = "0"
              }
       
          }).Value(1)
%>

I don't understand where I say to the Grid when in edit use that template...I've downloaded http://www.kendoui.com/code-library/mvc/grid/grid-inline-and-popup-editing-using-cascading-dropdownlists.aspx but it's razor and I'm using ASPX ... anyone can help me?

I wish those data to be loaded from the Controller

I've just got a method (first it would just be enougth to load statically),later my method will be

  [HttpPost]
        public ActionResult GetStati([DataSourceRequest] DataSourceRequest request, int idUser)
        {
            DataAccessAdministration da = new DataAccessAdministration(Global.IDApplication, IDIstituto);

            var res = da.GetStati(idUser);
            return Json(res.ToDataSourceResult(request));
        }

Please help me thanks!

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 01 Aug 2013, 12:28 PM
Hi Paolo,

 
Basically to be able to use the editor template that you created you should decorate the model property with a UIHint data annotation attribute and place the template under the EditorTemplates folder. More information is available in this help article. 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Michele
Top achievements
Rank 2
Answers by
Vladimir Iliev
Telerik team
Share this question
or