I'm trying to pass the model from my parent view through to the partial views that are being loaded in the tabstrip. At this point, what seems to be passed is a List<string> containing the type of the model rather than the model itself, which is a List<string> containing the words "Hello" and "Goodbye". Here's some sample code that demonstrates the issue.
The controller:
public
ActionResult TabStrip()
{
ViewBag.Message =
"TabStrip Test"
;
List<
string
> details =
new
List<
string
>();
details.Add(
"Hello"
);
details.Add(
"Goodbye"
);
return
View(details);
}
public
ActionResult TabA(List<
string
> details)
{
return
PartialView(details);
}
public
ActionResult TabB(List<
string
> details)
{
return
PartialView(details);
}
The main View:
@model List<
string
>
@{
ViewBag.Title = "TabStrip";
}
<
h2
>TabStrip</
h2
>
@Model[0], @Model[1]
@(Html.Kendo().TabStrip()
.Name("tabstrip")
.Items(tabstrip =>
{
tabstrip.Add().Text("Tab A")
.Selected(true)
.LoadContentFrom("TabA", "Home", new { details = Model });
tabstrip.Add().Text("Tab B")
.Selected(true)
.LoadContentFrom("TabB", "Home", new { details = Model });
}))
The Partial Views:
Tab A:
@model List<
string
>
<
p
>Welcome to TabA!</
p
>
@Model[0]
Tab B:
@model List<
string
>
<
p
>Welcome to TabB!</
p
>
@Model[1] -- causes error
The result upon first loading the page is attached. The first item in the list shows up in the partial view as "System.Collections.Generic.List`1[System.String]" rather than "Hello." Upon clicking Tab B, an exception is thrown because there is no second item in the list.
So clearly the model is not being passed correctly to the partial views. Any ideas on this?
Thanks!
Laurie