This question is locked. New answers and comments are not allowed.
Hi there,
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.
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.