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

[Solved] Checkboxes staying unchecked

0 Answers 42 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.
Dan
Top achievements
Rank 1
Dan asked on 13 Jul 2012, 07:58 AM
i am working on a project where we have sports people that we show in telerik grid

here we need to know if they are professional, this is handled by a bool, so far so good
it works good when i start the page but if i refresh via the toolbar in the bottom, the checkboxes we use are changed to its string value, how can i avoid this? 

@(
    Html.Telerik().Grid(Model)
        .Name("Player")
        .ClientEvents(events =>
        {
            events.OnDataBound("Grid_onDataBound");
            events.OnSubmitChanges("Grid_onSubmitChanges");
            events.OnError("Grid_onError");
        })
        .Sortable(sorting => sorting.Enabled(true))
        .DataKeys(keys => keys.Add(o => o.Id)
            .RouteKey("Id"))
        .ToolBar(commands =>
        {
            commands.Insert().ButtonType(GridButtonType.Image).ImageHtmlAttributes(new { style = "margin-left:0" });
            commands.SubmitChanges().ButtonType(GridButtonType.Image);
        })
        .DataBinding(dataBinding => dataBinding.Ajax()
            //.Insert("Players_update", "Player", new { Tournament = ViewBag.TournamentID })
            .Select("Select_players", "Player", new { Tournament = ViewBag.TournamentID })
            .Update("Players_update", "Player", new { Tournament = ViewBag.TournamentID })
            //.Delete("Players_update", "Player", new { Tournament = ViewBag.TournamentID })
        )
        .PrefixUrlParameters(false)
        .Columns(columns =>
        {
            columns.Bound(o => o.FirstName).Width(180);
            columns.Bound(o => o.LastName).Width(180);
            columns.Bound(o => o.Email).Width(200);
            columns.ForeignKey(o => o.Sex, (IEnumerable)ViewData["gender"], "Id", "Text").Width(120);
            columns.ForeignKey(o => o.Country, (IEnumerable)ViewData["country"], "Id", "Name").Width(120);
            columns
                .Bound(o => o.IsPro)
                .ClientTemplate("<input type='checkbox' name='IsPro' value='<#=IsPro#>' />")
                .Width(30);
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
                commands.Delete().ButtonType(GridButtonType.Image);
            });
        })
                .Editable(editing => editing.Mode(GridEditMode.InCell))
         .KeyboardNavigation(navigation => navigation.EditOnTab(true))
         )
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Share this question
or