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

[Solved] Dynamic TabStrip Load based on Parent Grid Row Index

0 Answers 109 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brad
Top achievements
Rank 1
Brad asked on 08 Aug 2012, 07:19 PM
I have a Telerik MVC Grid that is loading via ajax.

In this grid, I have a .DetailView with a TabStrip as the ClientTemplate.

Question: is there any way to know what the current row index is (or row datakey) in my TabStrip BindTo() method?  The Server-side      "<#= >" tags are working when naming the TabStrip like so: .Name("TabStrip_<#= GridRowId #>") 
But the .BindTo() seems to be taking the "<#= GridRowId #>" literally  

.DetailView(details => details.ClientTemplate(

                    Html.Telerik().TabStrip()

                        .Name("TabStrip_<#= GridRowId #>")

                        .SelectedIndex(0)

                        .BindTo(Model["<#= GridRowId #>"], (item, tabs) =>

                        {

                            foreach (TemplateTab tab in tabs)

                            {

                                item.Text = tab.TabText;

                                item.ActionName = tab.LoadContentFromAction;

                                item.ControllerName = tab.LoadContentFromController;

                            }

                        })

                        .ToHtmlString()

                    ))

I've also tried something similar without the .BindTo, and same results.  If I hard-code the "12" in my Model (which is a dictionary), it works.  But if I use Model["<#= GridRowId #>"], again the string within the quotes is taken literally:


.DetailView(details => details.ClientTemplate(
                    Html.Telerik().TabStrip()
                        .Name("TabStrip_<#= GridRowId #>")
                        .SelectedIndex(0)
                        .Items(tabstrip =>
                            {
                                foreach (var tab in Model["12"])
                                {
                                    tabstrip.Add()
                                         .Text(tab.TabText)
                                         .LoadContentFrom(tab.LoadContentFromAction, tab.LoadContentFromController, new { BoardingTaskID = tab.BoardingTaskId, EdocTemplateID = tab.EdocTemplateId, SessionId = tab.SessionId, IsReadOnly = tab.IsReadOnly });
                                }
                            }
                        )
                        .ToHtmlString()
                    ))

Tags
TabStrip
Asked by
Brad
Top achievements
Rank 1
Share this question
or