Environment:
1. ASP.NET MVC version - MVC 2
2. OS - Windows XP
3. exact browser version - IE 8
4. exact version of the Telerik product - Q2 2010 Beta
5. preferred programming language (VB.NET or C#) - C#
I have a situation where I have an object collection "StackCollection" that contains a list of the following object:
public class StackInfo
{
public string ControlPath { get; set; }
public string ImageURL { get; set; }
public int Index { get; set; }
public string Text { get; set; }
}
An example of the data I have in the collection is (pulled from a config file):
<StackCollection>
<add Text="PO Confirmation" ImageURL="~/content/navigation/toolbar/new.png" ControlPath="/Navigation/POConfirmationNav" Index="0"/>
<add Text="SKU Validation" ImageURL="~/content/navigation/toolbar/new.png" ControlPath="/Navigation/SKUValidationNav" Index="1"/>
</StackCollection>
I need to bind this collection to PanelBar that Displays the Image and Text as PanelBarItems and loads the .ascx control listed in the ControlPath property as a child item in the Items collection. Can someone tell me how I can accomplish this? I have tried numerous things. Currently, my View and Controler looks like this:
public class NavigationController : Controller
{
public ActionResult LeftNav()
{
return View();
}
public ActionResult SkuValidationNav()
{
//var item = new PanelBarItem();
//item.??? = this.PartialView("SkuValidation");
return View();
}
}
My LeftNav partial View has this:
<% Html.Telerik().PanelBar()
.Name("LeftNavPanelBar")
.ExpandMode(PanelBarExpandMode.Multiple)
.Theme("Office2007")
.BindTo(UIStandardSettings.Settings.StackCollection, mappings =>
{
mappings.For<StackInfo>(binding => binding
.ItemDataBound((item, si) =>
{
item.Text = si.Text;
item.ImageUrl = si.ImageURL;
item.Expanded = true;
item.Items.Add(new PanelBarItem(){ ControllerName = si.ControlPath});
})
);
}).Render();
%>
I have it working to the point that I can display the Image and Text, but I am stuck on how to load the child control/view.
Thanks,
Jason