I'm using the Telerik PanelBar to do some asynchronous loading using a partial view. I'm creating a model for the partial view in a parent view, but for some reason my data isn't coming through in tact.
// Parent view
<% Html.Telerik().PanelBar().Name("PanelBar").HtmlAttributes(new { style = "padding-left: 0em;" }).Items(items =>
{
foreach (var item in Model.Visits)
{
SiteVisitDetailModel model = new SiteVisitDetailModel();
model.URL = item.Key; // this is properly set
model.Dates = new List<DateTime>(); // this is null in the controller
model.Dates.Add(DateTime.Now);
items.Add()
.Text(item.Key.ToString() + " " + item.Count().ToString() + " visits")
.LoadContentFrom("SiteViewDetail", "Report", model);
}
}).Render();
// Report controller method
public ActionResult SiteViewDetail(SiteVisitDetailModel model)
{
return PartialView(model); // model.URL is correct, model.Dates is null
}
// Model
public class SiteVisitDetailModel
{
public String URL
{
get;
set;
}
public List<DateTime> Dates
{
get;
set;
}
}
As suggested by my comments, when the controller's SiteVisitDetail method is called, Model.URL has the correct data, and Model.Dates is null (it's not a list containing null, it itself is null). It, as would be expected, is also null in the partial view (SiteViewDetail).
What would cause this behavior?