locked
get the selected tab from tabstrip RRS feed

  • Question

  • User-1954338773 posted

    Hi there,

    Not sure if this is the right place to ask. How could I get the selected text from the tab strip so I can use that in my grid to display the columns based on the tab selected?

    Here is my code.


    @(Html.Telerik().TabStrip()
        .Name("MediaYear")
        .Items(tabstrip =>
        {
            bool selected = true;
            if (Model.MediaTypes != null)
            {
                foreach (string t in Model.MediaTypes)
                {
                    tabstrip.Add()
                            .Text(t)
                            .Selected(selected);
                    selected = false;
                }
            }
        })
        .ClientEvents(events =>
        {
            events.OnSelect("onSelectMedia");
        })
    )
     
    @(Html.Telerik().Grid(Model.Actuals)
            .Name("Grid")
            .HtmlAttributes(new { dataid = Model.CenterId })
            .DataKeys(keys =>
            {
                keys.Add(r => r.ParentDetailId);
            })
            .Columns(columns =>
            {
                  if (selected text from the tab is Newspaper)
                {
                    columns.Bound(r => r.VendorPreference).Title("Newspaper");
                    columns.Bound(r => r.StartDate).Title("Insertion Date");
                    columns.Bound(r => r.Day);
                    columns.Bound(r => r.AdSize);
                }
                if (selected text from the tab is Radio)
                {
                    columns.Bound(r => r.VendorPreference).Title("Station");
                    columns.Bound(r => r.AdSize + " seconds");
                    columns.Bound(r => r.StartDate).Title("Start Date");
                    columns.Bound(r => r.Position).Title("Time");
                    columns.Bound(r => r.Quantity).Title("Number of Spots");
                }
    })
            .DataBinding(dataBinding =>
            {
                dataBinding.Ajax().Select("_SelectAjaxEditing", "AMSMediaList", new { area = "UserControls", id = Model.CenterId, year = Model.Year });
            })
            .Filterable(filtering => filtering.Filters(filters => {
                if (Model.MediaTypes != null && Model.MediaTypes.Count > 0) filters.Add(r => r.MediaTypeDesc).IsEqualTo(Model.MediaTypes.First());
            }))
            .Pageable(paging => paging.PageSize(15))
            .Sortable()
            .Resizable(resizing => resizing.Columns(true))
            .ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
        )
    
    How would I get the selected tab text? Let me know if you need further information.



    Tuesday, February 15, 2011 9:16 AM

All replies

  • User-1954338773 posted

    I was able to resolve this. 

    Friday, February 25, 2011 10:17 AM