have a little problem here.
So i'm trying to create a tabstrip for categories and subcategories. So i bind the Telerik asp.net mvc tabstrib to my model and load as content a partial view. In the partial view i load from the selected categorie the subcategories and items within that subcategorie. my code looks like that:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%
Html.Telerik().TabStrip()
.Name("TabStrip")
.Items(items =>
{
foreach (
var sub in ViewData["ChildTabs"] as IEnumerable<MyLuckyNamespace.Models.TabData>)
{
items
.Add().Text(sub.Text)
.Enabled(Convert.ToBoolean(sub.Enabled))
.Selected(Convert.ToBoolean(sub.IsDefault))
.Content(() =>
{
%>
<script language="javascript" type="text/javascript">
$(function() {
$("form").submit(function(e) {
$.post($(this).attr("action"),
$(this).serialize(),
function(data) {
$("#result").html(data);
});
e.preventDefault();
});
});
</script>
<%
if (sub.Components.Count() > 0)
{
foreach (var component in sub.Components)
{
using (Html.BeginForm("Action", "controllername", new {Id = component.Id} ))
{ %>
<%= Html.AntiForgeryToken("Sample") %>
<%
// Here starts the components
%>
<input type="submit" value="<%: component.Title %>" />
<%
}
}
}
else
{
%> <p>No Components in this category!</p> <%
}
});
}
})
//.SelectedIndex(0)
.Render();
%>
So my problem is, that the components of the subcategories always show the same components.