Enable textbox based on Checkbox

2 posts, 0 answers
  1. vikas
    vikas avatar
    11 posts
    Member since:
    May 2011

    Posted 25 Aug 2014 Link to this post

    Hi Team,
    I have the following columns in a grid in my MVVM project.
    checkbox_Column Textbox1_column Textbox2_Column.

    My requirement is - when i check the checkbox, Textbox2_Column should get disabled and when i un-check the checkbox Textbox1_column should get disabled.

    Can you please tell me how to do this.

    Thanks,
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Aug 2014 Link to this post

    Hi,

    I would suggest you working with the bound data items. In your case you should have a boolean property of the bound business object, for example it can be IsChecked.
    Then, you can consider using the IsReadOnlyBinding property of the column. Please check our online documentation for more information on how it works.
    For example:

    <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsChecked}"/>
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"  IsReadOnlyBinding="{Binding IsChecked}"/>

    That way when the CheckBox is checked, the respective cell in the data column displaying the Name will be disabled.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top