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

TabStrip Name does not get replaced

3 Answers 44 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Darryl
Top achievements
Rank 1
Darryl asked on 25 Feb 2016, 08:20 PM

In the attached picture, the id is equal to "tabStrip_#=Name#", but the #=Name# portion should be replaced with the name from the ViewModel.

<div class="row " style="max-width: 98%">
    <div class="columns">
        <div class="full-width">
            @(Html.Kendo().Grid<EPP.AdminPortal.ViewModels.Test>
                  ()
                  .Name("grid")
                  .HtmlAttributes(new {style = "table-layout: fixed, height: 550px;"})
                  .Columns(columns =>
                  {
                      columns.Bound(c => c.Id).Width(1000);
                      columns.Bound(c => c.Name).Width(2000);
                      columns.Bound(c => c.Email).Width(5000);
                      columns.Bound(c => c.Ap).Width(5000);
                      columns.Bound(c => c.Bp).Width(5000);
                      columns.Bound(c => c.Cp).Width(5000);
                      columns.Bound(c => c.Dp).Width(5000);
                      columns.Bound(c => c.Ep).Width(5000);
                      columns.Bound(c => c.Fp).Width(200);
                  })
                  .ClientDetailTemplateId("template")
                  .DataSource(dataSource => dataSource
                      .Ajax()
                      .Read(read => read.Action("T_Read", "Test"))
                  )
                  //.Groupable()
                  .Sortable()
                  )
        </div>
    </div>
</div>

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
    .Name("tabStrip_#=Name#")
    .SelectedIndex(0)
    .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
    .Items(items =>{
              items.Add().Text("Contact Person").Content("Jeremy");
            }   
       ).ToClientTemplate())
</script>

3 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 26 Feb 2016, 12:49 PM
Hi Darryl,

The following code should work:

//model:

namespace Kendo.Mvc.Examples.Models
{
    public class TestingViewModel
    {
        public static string Testing = "Testing";
 
    }
}

//view:
........................
.Name(String.Concat("tabStrip_", Kendo.Mvc.Examples.Models.ProductViewModel.Testing))


Regards,
Helen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Darryl
Top achievements
Rank 1
answered on 26 Feb 2016, 05:24 PM
Hi Helen that works fine, but the problem is is that each tabStrip needs to have a unique name.
0
Helen
Telerik team
answered on 29 Feb 2016, 09:21 AM
Hi Darryl,

Another possible solution is to generate a random name in the controller and retrieve it trough the ViewBag:

http://www.telerik.com/forums/how-to-use-assign-a-dynamic-name-property


Regards,
Helen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TabStrip
Asked by
Darryl
Top achievements
Rank 1
Answers by
Helen
Telerik team
Darryl
Top achievements
Rank 1
Share this question
or