Color picker in bound grid never sets the model property

2 posts, 0 answers
  1. Karl
    Karl avatar
    9 posts
    Member since:
    Oct 2012

    Posted 24 Aug 2015 Link to this post

    I am trying to use the grid with a colorpicker to set a colorcode property on my model and even so the column is bound, I can never see the updated code when the model is sent to the controller.  I am using the standard in line editing function of the grid. (which manages to update teh model for simple properties.


            .Columns(columns =>
                columns.Bound(p => p.ColourCode).Title("Colour").Width("84px").ClientTemplate("<span style='display: inline-block; width: 100%; height: 100%; background-color: #= ColourCode #'>&nbsp;</span>");
                columns.Command(m =>

            .HtmlAttributes(new { style = "height:850px;width:100%" })
            .Scrollable(scr => scr.Enabled(true))
            .DataSource(dataSource => dataSource
                .Model(m => m.Id(p => p.Id))
                .Create(update => update.Action("AllocationPortfolioInsert", "DataManagement"))
                .Update(update => update.Action("AllocationPortfolioUpdate", "DataManagement"))
                .Destroy(update => update.Action("AllocationPortfolioDelete", "DataManagement"))



    @model string
    @(Html.Kendo().ColorPickerFor(m => m)
        .Events(e => e.Change("colourPickerChange"))



        private string colourCode;
            public string ColourCode
                get { return colourCode; }
                set { this.colourCode = newValue;}

  2. Karl
    Karl avatar
    9 posts
    Member since:
    Oct 2012

    Posted 25 Aug 2015 Link to this post

    I found what the issue was.  Unless the name property of the colour picker control is called exactly the same as the model property, the binding will not work
Back to Top