This question is locked. New answers and comments are not allowed.
EDIT: Sorry, Title should read "Recursive PartialView in Grid DetailView"
Hi,
I using MVC 3, EF4.1, Telerik 2011.1.315.
Is it possible to recursively load a PartialView within a grid's DetailsView.
My logic involves a Tree-like structure of Groups. The pseudo POCO looks like this:
class Group {
int GroupId{ };
int ParentGroupID{ };
virtual IList<Group> SubGroups { }
}
I have a Ajaxed Grid set up in a PartialView (partial.ascx) which int urn is embedded
in a View (view.aspx). In the grid's DetailView, I hava a TabStrip. In the first tab,
I'm trying to recursively reload the PartialView so that the grid looks like this:
On the Controller, I have the initial call, the Ajax call, and the call
for .LoadContentFrom():
The result: The outer-most grid loads perfectly; Both Index and _Index actions fire
respectively. However, when I click the "+" to expand a row, the GetPartial action
fires, then Index, but the _Index Ajax call doesn't fire again, and my child grid
(while rendered very nicely) remains empty.
What canI do to fix this?
Many thanks,
Radu
EDIT: Sorry for the ludicrous code blocks.Hi,
I using MVC 3, EF4.1, Telerik 2011.1.315.
Is it possible to recursively load a PartialView within a grid's DetailsView.
My logic involves a Tree-like structure of Groups. The pseudo POCO looks like this:
class Group {
int GroupId{ };
int ParentGroupID{ };
virtual IList<Group> SubGroups { }
}
I have a Ajaxed Grid set up in a PartialView (partial.ascx) which int urn is embedded
in a View (view.aspx). In the grid's DetailView, I hava a TabStrip. In the first tab,
I'm trying to recursively reload the PartialView so that the grid looks like this:
... .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_Index", "Groups", new { parentId = "<#= ParentGroupId #>" }) }) .DetailView(detailView => detailView.ClientTemplate( Html.Telerik().TabStrip().Name("TabStrip_<#= GroupId #>").SelectedIndex(0) .Items(items => { items.Add().Text("SubGroups") .LoadContentFrom("GetPartial", "Groups"); }).ToHtmlString()
...On the Controller, I have the initial call, the Ajax call, and the call
for .LoadContentFrom():
public ActionResult Index() { return PartialView(); } [GridAction] public ActionResult _Index(int? parentId) { List<Group> list = new List<Group>(); if (parentId != null) list = _Repository.Groups.Where(g => g.GroupId == parentId).First().SubGroups; else list = _Repository.Groups; return Json(new GridModel(list)); }public ActionResult GetPartial()
{
return PartialView("partial");
}
The result: The outer-most grid loads perfectly; Both Index and _Index actions fire
respectively. However, when I click the "+" to expand a row, the GetPartial action
fires, then Index, but the _Index Ajax call doesn't fire again, and my child grid
(while rendered very nicely) remains empty.
What canI do to fix this?
Many thanks,
Radu