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

Checkboxes staying unchecked

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 12 Jul 2012, 02:53 PM
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))
         )

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 14 Jul 2012, 09:21 AM
Hello,

if your project in mvc then please post your question in below forum
http://www.telerik.com/community/forums/aspnet-mvc/grid.aspx 

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or