TabStrip Name does not get replaced

4 posts, 0 answers
  1. Darryl
    Darryl avatar
    6 posts
    Member since:
    Nov 2015

    Posted 25 Feb Link to this post

    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>

  2. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 26 Feb Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Darryl
    Darryl avatar
    6 posts
    Member since:
    Nov 2015

    Posted 26 Feb in reply to Helen Link to this post

    Hi Helen that works fine, but the problem is is that each tabStrip needs to have a unique name.
  5. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 29 Feb Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready