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

Enable textbox based on Checkbox

1 Answer 138 Views
GridView
This is a migrated thread and some comments may be shown as answers.
vikas
Top achievements
Rank 1
vikas asked on 25 Aug 2014, 10:08 AM
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,

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 26 Aug 2014, 02:55 PM
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.
 
Tags
GridView
Asked by
vikas
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or