This question is locked. New answers and comments are not allowed.
I am using the Q3 MVC release. I have a three level Ajax Hierarchal grid. The first two levels of the grid work. When I add the third level, I get an error message from telerik.grid.min.js (line 1) which says:
"RepositoryName is not defined. [Break On This Error] (function(e){var b=e.telerik;var c=/"\..."groupBy",filter:"filter"}}})(jQuery);"
I set breakpoints in VS 2010 to see when the error is thrown. To my surprise, the error appears when the controller returns from the top level grid ActionResult (IndexHierarchyAjax) which works fine without the third level of the grid. I would be grateful for any suggestions you might have to resolve this issue. My Razor View and Controller appear below.
Thanks and regards,
Philip
My controller looks like this:
"RepositoryName is not defined. [Break On This Error] (function(e){var b=e.telerik;var c=/"\..."groupBy",filter:"filter"}}})(jQuery);"
I set breakpoints in VS 2010 to see when the error is thrown. To my surprise, the error appears when the controller returns from the top level grid ActionResult (IndexHierarchyAjax) which works fine without the third level of the grid. I would be grateful for any suggestions you might have to resolve this issue. My Razor View and Controller appear below.
Thanks and regards,
Philip
model IList<
CTAAS.Areas.StudySetupSvc.Models.CrfMetadata
>
@using Telerik.Web.Mvc.UI
@using CTAAS.Areas.StudySetupSvc.Models
@{
View.Title = "Study CRF List";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<
h2
>
Study CRF List</
h2
>
@(Html.Telerik().Grid<
CrfMetadata
>().Name("Grid").Columns(columns =>
{
columns.Bound(c => c.StudyId);
columns.Bound(c => c.CrfId);
columns.Bound(c => c.CrfName);
})
.ClientEvents(events => events.OnRowDataBound("crfMetadata_onRowDataBound"))
.DetailView(details => details.ClientTemplate(
Html.Telerik().Grid<
CrfWebPart
>()
.Name("CrfWebPart_" + "<#= RepositoryName #>")
.Columns(columns =>
{
columns.Bound(wp => wp.CrfId);
columns.Bound(wp => wp.Row);
columns.Bound(wp => wp.Column);
columns.Bound(wp => wp.RepositoryName);
columns.Bound(wp => wp.WebPartType);
})
.ClientEvents(events => events.OnRowDataBound("webParts_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("_WebPartHierarchyAjax", "Crf", new { CrfId = "<#= CrfId #>" }))
.ToHtmlString()
))
.DetailView(webPartsDetailView => webPartsDetailView.ClientTemplate(
Html.Telerik().Grid<
TextboxWebPartMetatdata
>()
.Name("CrfWebPartDetail_" + "<#= RepositoryName #>")
.Columns(columns =>
{
columns.Bound(tb => tb.RepositoryName);
columns.Bound(tb => tb.LabelName);
columns.Bound(tb => tb.Size);
columns.Bound(tb => tb.MaxLength);
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("_TextboxWebPartMetadataHierarchyAjax", "Grid", new { repositoryName = "<#= RepositoryName #>" }))
.ToHtmlString()
))
.DataBinding(dataBinding => dataBinding.Ajax().Select("_IndexHierarchyAjax", "Crf"))
)
<
script
type
=
"text/javascript"
>
// Expand the first row of the Master and Detail by Default
function expandFirstRow(grid, row)
{
if (grid.$rows().index(row) == 0)
{
grid.expandRow(row);
}
}
function crfMetadata_onRowDataBound(e)
{
var grid = $(this).data('tGrid');
expandFirstRow(grid, e.row);
}
function webParts_onRowDataBound(e)
{
var grid = $(this).data('tGrid');
expandFirstRow(grid, e.row);
}
</
script
>
My controller looks like this:
public ActionResult Index()
{
return View();
}
[GridAction]
public ActionResult _IndexHierarchyAjax()
{
IEnumerable<
CrfMetadata
> crfsUsedInTheStudy = _repositoryForCrf.GetStudyCrfMetadata();
return View(new GridModel(crfsUsedInTheStudy));
}
[GridAction]
public ActionResult _WebPartHierarchyAjax(int crfId)
{
var crfWebPartRepository = new CrfWebPartRepository();
var crfWebPartList = crfWebPartRepository.GetCrfWebParts(crfId);
return View(new GridModel(crfWebPartList));
}
[GridAction]
public ActionResult _TextboxWebPartMetadataHierarchyAjax (string repositoryName)
{
var textboxWebPartRepository = new TextboxWebPartMetadatRepository();
var textboxWebPartMetadata = textboxWebPartRepository.GetTextboxWebPartMetadata(repositoryName);
return View(new GridModel(textboxWebPartMetadata));
}