Hi,
I am trying to do something simple but having trouble.
All I want is a grid that displays columns for a name and an IsActive property.
I tried using:
<GridCheckboxColumn Field="@(nameof(AppRole.IsActive))" Title="Is Active"/>
but got nowhere with it.
The basic code is show below. How can I center the checkbox in the column and make not editable unless the are in edit mode?
Also, I want the checkboxes centered in the column.
Any help would be great.
Thanks … Ed
<
TelerikGrid
Data=@GridData
Pageable
=
"true"
Groupable
=
"true"
Sortable
=
"true"
OnUpdate
=
"@UpdateHandler"
OnDelete
=
"@DeleteHandler"
OnCreate
=
"@CreateHandler"
OnEdit
=
"@EditHandler"
>
<
GridColumns
>
<
GridColumn
Field
=
"Name"
/>
<
GridColumn
Field
=
"@(nameof(AppRole.IsActive))"
Title
=
"Is Active"
>
<
Template
Context
=
"ctx"
>
@{
var r = ctx as AppRole;
var chk = r.IsActive ? "checked" : "";
<
input
type
=
"checkbox"
checked
=
"@chk"
/>
}
</
Template
>
</
GridColumn
>
<
GridCommandColumn
Width
=
"300px"
>
<
GridCommandButton
Command
=
"Save"
Icon
=
"save"
ShowInEdit
=
"true"
>Update</
GridCommandButton
>
<
GridCommandButton
Command
=
"Edit"
Icon
=
"edit"
>Edit</
GridCommandButton
>
<
GridCommandButton
Command
=
"Delete"
Icon
=
"delete"
>Delete</
GridCommandButton
>
<
GridCommandButton
Command
=
"Cancel"
Icon
=
"cancel"
ShowInEdit
=
"true"
>Cancel</
GridCommandButton
>
</
GridCommandColumn
>
</
GridColumns
>
<
GridToolBar
>
<
GridCommandButton
Command
=
"Add"
Icon
=
"add"
>Create Role</
GridCommandButton
>
</
GridToolBar
>
</
TelerikGrid
>