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

Grid Check Box Read Only

1 Answer 85 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.
Adam
Top achievements
Rank 1
Adam asked on 07 Mar 2011, 01:26 PM
Hi all,

I am wanting to use a checkbox inside a telerik mvc grid.

Using the code below, the checkbox is always rendered read only; i don't know why!

 

@{Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>

{
    columns.Bound(m => m.IsRequired)
        .ClientTemplate("<input type='checkbox' name='IsRequired' value='<#= IsRequired #>' />")
        .HtmlAttributes(new {style="text-align:center"})
        .Title("")
        .Width(20);
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("IsRequired","Grid"))
.Pageable()
.Scrollable()
.Render();}

 

 

 

Any thoughts?

Thanks. 

 

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 07 Mar 2011, 04:25 PM
Hello Adam,

The cause for the behavior you are experiencing is the fact that our grid component will use the MVC framework built-in template infrastructure to visualize column's data. Thus, as you may know, the default display template for boolean type will render a disabled checkbox.

Therefore, the easiest way to achieve the functionality in question will be to set column's both ClientTemplate and Template properties, taking control over the way data is displayed. 

More information on MVC's display and edit template can be found here. For information on how they are integrated in our grid component follow this link.

All the best,
Rosen
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or