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

[Solved] bound columns not binding

0 Answers 72 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.
william
Top achievements
Rank 1
william asked on 22 Jul 2011, 04:40 PM
Hi All,

I have the following :
@model GRID.ViewModels.ComputerBreakDownSectionViewModel
@{
    ViewBag.Title = "Index";
}
@Html.Hidden("policyZoneID", ViewData["policyZoneID"])
@Html.Hidden("sectionID", ViewData["sectionID"])
 
<h2>
    Risks</h2>
 
 @(Html.Telerik().Grid<GRID.ViewModels.ComputerBreakdownRiskViewModel>()
    .Name("computerRisksGrid")
    .Sortable()
    .DataKeys(keys => keys.Add(r => r.ComputerBreakdownRiskID))
    .ToolBar(commands => commands.Custom().ButtonType(GridButtonType.ImageAndText).Text("Add New Risk").HtmlAttributes(new { @class = "addRisk" }).Action("Create", "ComputerBreakdownRisk", new { policyZoneID = ViewData["policyZoneID"], sectionID = ViewData["sectionID"] }))
    .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .Select("_RisksIndex", "ComputerBreakdownSection", new { policyZoneID = ViewData["policyZoneID"], sectionID = ViewData["sectionID"] });
        })
    .Columns(columns =>
              {
                  columns.Bound(r => r.ComputerBreakdownRiskID).Title("Edit").Sortable(false).Filterable(false)
                                 .Template(r => @Html.ActionLink("Edit", "Edit", "ComputerBreakdownRisk",
                                 new { riskID = r.ComputerBreakdownRiskID, policyZoneID = ViewData["policyZoneID"], sectionID = r.ComputerBreakdownSectionID }, new { @class = "editLink", @title = "Edit Risk" })).Width(6);
                  columns.Bound(r => r.ComputerBreakdownRiskID).Title("Delete").Sortable(false).Filterable(false)
                                 .Template(r => @Html.ActionLink("Delete", "Delete", "ComputerBreakdownRisk",
                                 new { riskID = r.ComputerBreakdownRiskID, policyZoneID = ViewData["policyZoneID"], sectionID = r.ComputerBreakdownSectionID }, new { @class = "deleteLink", @title = "Delete Risk" })).Width(6);
                  columns.Bound(r => r.Description);
                  columns.Bound(r => r.IndemnityPeriod);......

The first 2 bound columns using the template do not appear in my grid nor are there any empty columns at the start of the grid to denote where these should be. My very first column is the description.

I have other pages with the Grid columns being bound in this way and they work fine. Why isn't this grid if nothing else showing 2 empty columns?
Tags
Grid
Asked by
william
Top achievements
Rank 1
Share this question
or