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

[Solved] 500 error when no data in mvc grid

0 Answers 98 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.
andy
Top achievements
Rank 1
andy asked on 15 Feb 2011, 12:46 AM
Hi,

I get the following behavior: When there is no data loaded into my MVC Grid, I get a 500 error. However when data is loaded into the grid, everything shows up fine. Below is the code in my ASPX page...Any suggestions?

Html.Telerik().Grid<DataNet.WebUI.ViewModels.AgreementResultsViewModel>(Model.AgreementSearchResults)
 .Name("FieldsGrid")
 .Resizable(r => r.Columns(true))
 .Scrollable(s => s.Height(200))
 .DataBinding(dataBinding => dataBinding.Ajax().Select("SelectAgreement", "FindAgreement"))
 .DataKeys(keys => keys.Add(c => c.BuildingId))
 .Columns(columns =>
  {
   columns.Template(s => Html.ActionLink("Select", "SelectAgreement", new { s.BuildingId, s.ProjectId }))
    .ClientTemplate("<a href=\"" + Url.Action("SelectAgreement", "FindAgreement") + "/<#= BuildingId#>\">Edit</a>")
    .Title("Select");
   columns.Bound(c => c.BuildingId);
   columns.Bound(c => c.LeaseCode);
   columns.Bound(c => c.SiteName);
   columns.Bound(c => c.Address);     
  })
 .NoRecordsTemplate("No Agreements were found")
 .Footer(false)
 .Render();

Thanks
Tags
Grid
Asked by
andy
Top achievements
Rank 1
Share this question
or