This is a migrated thread and some comments may be shown as answers.

[Solved] tabstrip in tabstrip content problem

0 Answers 44 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Patric
Top achievements
Rank 1
Patric asked on 27 Sep 2010, 05:36 PM
Hey guys,

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.

 

Tags
General Discussions
Asked by
Patric
Top achievements
Rank 1
Share this question
or