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

[Solved] Display bool in Grid as a selectable Checkbox

4 Answers 193 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.
Matthew
Top achievements
Rank 1
Matthew asked on 04 Jan 2011, 04:26 PM
I've only been working with Telerik controls for a few days now and so far I'm liking the results I'm getting. At this moment, I have a model (class) with a bunch of Strings as members. I also have a member called "Select" which is a Boolean (by default set to False). I would like this Bool to be represented as a "Checkbox" in the Grid control.

This way, the user can check as many boxes as they wish, then click a Submit button below the grid. The form would then return a list of all the lines that the user selected to a new controller.

I got this far:

Html.Telerik().Grid(Model).Name("Query")  
    .Columns(c => {           
       c.Bound(o => o.Select).Width(50).ReadOnly(
false).Filterable(false)

But wasn't sure how to get the Bool in my model to be represented as a selectable check box?

4 Answers, 1 is accepted

Sort by
0
Accepted
Demon
Top achievements
Rank 1
answered on 04 Jan 2011, 05:40 PM
Hi,

Here is a demo, which does pretty much the same:

http://demos.telerik.com/aspnet-mvc/grid/checkboxesserverside
0
Matthew
Top achievements
Rank 1
answered on 04 Jan 2011, 07:06 PM
That was it! Thanks.  :)
0
Matthew
Top achievements
Rank 1
answered on 10 Jan 2011, 07:35 PM
Okay, next question:

How do I put a checkbox in the header (at the top of the checkbox column) to perform a "Select All" or "De-select All" type function?

0
Matthew
Top achievements
Rank 1
answered on 11 Jan 2011, 07:47 PM
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Demon
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Share this question
or