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

Boolean appears as dropdown in grid

2 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark Shortt
Top achievements
Rank 1
Mark Shortt asked on 23 May 2011, 04:34 PM
Hi

I'm using a grid to list and edit some data items. One field is a boolean that I want to edit using checkboxes.

Following the examples I've configured the column to use a checkbox as follows:

 columns.Bound(o => o.Visible).ClientTemplate("<input type='checkbox' disabled='disabled' name='Visible' <#=Visible? checked='checked' : '' #> />");

My problem is that when it goes into edit mode the checkbox is replaced with a dropdown box with the values "Not Set", "True" & "False", and even if the value is already true it appears as "Not Set".

Can anyone suggest a way to fix this?

Thanks

Mark

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 23 May 2011, 04:52 PM
Hi Mark Shortt,

 This is the default editor template rendered by ASP.NET MVC for nullable boolean fields. If you want only a checkbox you should make your property a regular boolean (not nullable). On a side note the ClientTemplate is only used in read only mode. If you want to customize the editor of your property you should create an editor template.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark Shortt
Top achievements
Rank 1
answered on 23 May 2011, 04:55 PM
Brilliant, that worked straight away

Thanks

Tags
Grid
Asked by
Mark Shortt
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mark Shortt
Top achievements
Rank 1
Share this question
or