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

Loading dynamic items in Tabstrip

0 Answers 34 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.
jim
Top achievements
Rank 1
jim asked on 29 Jul 2011, 04:15 AM
I am trying to load a partial view which has a tabstrip.  I am making a jQuery ajax call to the controller which returns a partial view which contains the tab strip. I believe all the Telerik JS is being loaded properly.

Here are pieces of the partial view:

<% Html.Telerik().TabStrip()
            .Name("TabStrip")
            .Items(tabstrip =>
            {
                foreach (FooType foo in Model.Section) {
                    tabstrip.Add()
                        .Text(foo.Name.ToString())
                        .Content(() =>
                        {%>
                            <div><%= foo.bar.ToString() %></div>
                        <%});
                }
            })
            .SelectedIndex(0)
            .Render();
    %>

The problem is that <div> has the same content no matter what. Its always the last item from Model.Section. The tab text is is outputted correctly though.

I've tried replacing the foo.bar.ToString with a counter that get incremented at each iteration, but the tabs end up all having the same value, the last counter value.

What am I missing?
Tags
General Discussions
Asked by
jim
Top achievements
Rank 1
Share this question
or