Conditionally enable cell based on value of another

2 posts, 1 answers
  1. Andrew
    Andrew avatar
    5 posts
    Member since:
    Apr 2011

    Posted 16 Jan 2015 Link to this post

    I have the following grid:

                        .Columns(columns =>
                            columns.Bound(m => m.codeType).ClientTemplate("#=codeType.code_type#").Width(75);
                            columns.Bound(m => m.codeVersion).ClientTemplate("#=codeVersion.code_version#").Width(75);
                        .Editable(editable => editable.Mode(GridEditMode.InCell))
                        .Events(events => events.DataBound("onDataBound"))

    Both columns use a combo box for the EditorTemplate.
    I am looking for a solution that disables the 2nd column on default.  Then based on value selected for 1st column, column 2 is either enabled or stays disabled.

    Any guidance would be much appreciated.
  2. Answer
    Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 20 Jan 2015 Link to this post

    Hi Andrew,

    You can use the edit event, where you can check the currently column being edited and the values in the model and either prevent the editing or allow it. Here is an example:

    Kiril Nikolov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top