This question is locked. New answers and comments are not allowed.
good morning everyone,
i am trying to create a checkbox column where i have a model with a bool property of which i am binding the model to a grid. visually, i want to display a column of checkboxes that are bound to a bool type property called "IsActive". so there are some records where it is active and some records that are not active. And visually, those checkboxes should be checked or not checked depending on the value of the "IsActive" property. how would i go about doing that because what i am trying so far is not working. I am trying to setup everything where i am using ClientTemplate, Ajax binding, Ajax Checkboxes. Basically trying to make the the binding of the grid and posting of the grid to be completely ajax and client side stuff.
the following is my model:
the following is my view:
my syntax for setting up the "ClientTemplate" and Ajax Checkboxes doesn't seem to be correct. i am not sure what the correct syntax should be.
thank you very much for your help and taking a look at my post.
much appreciate it
have a great day
i am trying to create a checkbox column where i have a model with a bool property of which i am binding the model to a grid. visually, i want to display a column of checkboxes that are bound to a bool type property called "IsActive". so there are some records where it is active and some records that are not active. And visually, those checkboxes should be checked or not checked depending on the value of the "IsActive" property. how would i go about doing that because what i am trying so far is not working. I am trying to setup everything where i am using ClientTemplate, Ajax binding, Ajax Checkboxes. Basically trying to make the the binding of the grid and posting of the grid to be completely ajax and client side stuff.
the following is my model:
public class PublicationType { public int Id { get; set; } [Display(Name = "Pub Type Code")] public string PublicationTypeCode { get; set; } [Display(Name = "Pub Type Name")] public string PublicationTypeName { get; set; } [Display(Name = "Is Active")] public bool IsActive { get; set; } }the following is my view:
@{Html.Telerik().Grid(Model) .Name("grdPubTypeInfo") .DataKeys(keys => keys.Add(k => k.Id) ) .Columns(columns => { columns.Bound(o => o.Code) .Width(50); columns.Bound(o => o.Name) .Width(400); columns.Bound(o => o.IsActive) .Width(75) .Filterable(false) .HtmlAttributes(new { style = "text-align:center" }) .ClientTemplate("" + @Html.CheckBox("chkPublicationType_IsActive", Convert.ToBoolean("<#= IsActive #>"), new { disabled = "disabled", id = "chkPublicationType_IsActive" }) + ""); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); }) .Width(40) .HtmlAttributes(new { style = "text-align:center" }); }) .DataBinding(dataBinding => { // The action method will return JSON dataBinding.Ajax().Select("PublicationType_AjaxResultBinding_PubTypeInfo", "PublicationType"); dataBinding.Ajax().Update("PublicationType_AjaxResultBinding_PubTypeInfo", "PublicationType"); }) .NoRecordsTemplate(@<text>No Publication Type records to display.</text>) .Pageable(paging => paging.PageSize(15) ) .Sortable() .Filterable() .Render();}my syntax for setting up the "ClientTemplate" and Ajax Checkboxes doesn't seem to be correct. i am not sure what the correct syntax should be.
thank you very much for your help and taking a look at my post.
much appreciate it
have a great day