Unplanned
Last Updated: 08 Apr 2020 14:20 by ADMIN
Guy Tubbs
Created on: 17 Feb 2020 12:08
Category: Grid
Type: Bug Report
1
Controls in GridFilteringItem are not affected by the EnableEmbeddedBaseStylesheet property of the Grid
We have found a problem, which is that the filters do not seem to take the EnableEmbeddedBaseStylesheet settings from the Grid.
1 comment
ADMIN
Attila Antal
Posted on: 17 Feb 2020 13:40

Thank you for your time in reporting this problem. The Input controls in the filtering are indeed not affected by the EnableEmbeddedBaseStylesheet settings from the Grid. 

Controls related to this issue are RadTextBox, RadNumericTextBox, RadTimePicker, RadDatePicker and RadDateTimePicker

A possible workaround would be to access the controls following the Accessing Values and Controls article and disable their stylesheet explicitly.

C#

protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if ((sender as RadGrid).AllowFilteringByColumn && e.Item is GridFilteringItem)
    {
        var grid = (sender as RadGrid);
        var filterItem = (e.Item as GridFilteringItem);
        foreach (var column in grid.MasterTableView.RenderColumns.Where(x => x.SupportsFiltering() & x.Visible))
        {
            var filterControl = filterItem[column.UniqueName].Controls[0];
            if (filterControl is RadTextBox)
            {
                ((RadTextBox)filterControl).EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
            }
            else if (filterControl is RadNumericTextBox)
            {
                ((RadNumericTextBox)filterControl).EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
            }
            else if (filterControl is RadTimePicker)
            {
                var timePicker = (RadTimePicker)filterControl;
                timePicker.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                timePicker.TimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                timePicker.SharedTimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
            }
            else if (filterControl is RadDatePicker)
            {
                var datePicker = (RadDatePicker)filterControl;
                datePicker.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                datePicker.Calendar.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                datePicker.SharedCalendar.EnableEmbeddedBaseStylesheet = false;
            }
            else if (filterControl is RadDateTimePicker)
            {
                var dateTimePicker = (RadDateTimePicker)filterControl;
                dateTimePicker.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                dateTimePicker.TimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                dateTimePicker.SharedTimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                dateTimePicker.Calendar.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
                dateTimePicker.SharedCalendar.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet;
            }
        }
    }
}

 

VB

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
    If (TryCast(sender, RadGrid)).AllowFilteringByColumn AndAlso TypeOf e.Item Is GridFilteringItem Then
        Dim grid = (TryCast(sender, RadGrid))
        Dim filterItem = (TryCast(e.Item, GridFilteringItem))
        For Each column In grid.MasterTableView.RenderColumns.Where(Function(x) x.SupportsFiltering() And x.Visible)
            Dim filterControl = filterItem(column.UniqueName).Controls(0)
            If TypeOf filterControl Is RadTextBox Then
                CType(filterControl, RadTextBox).EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
            ElseIf TypeOf filterControl Is RadNumericTextBox Then
                CType(filterControl, RadNumericTextBox).EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
            ElseIf TypeOf filterControl Is RadTimePicker Then
                Dim timePicker = CType(filterControl, RadTimePicker)
                timePicker.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                timePicker.TimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                timePicker.SharedTimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
            ElseIf TypeOf filterControl Is RadDatePicker Then
                Dim datePicker = CType(filterControl, RadDatePicker)
                datePicker.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                datePicker.Calendar.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                datePicker.SharedCalendar.EnableEmbeddedBaseStylesheet = False
            ElseIf TypeOf filterControl Is RadDateTimePicker Then
                Dim dateTimePicker = CType(filterControl, RadDateTimePicker)
                dateTimePicker.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                dateTimePicker.TimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                dateTimePicker.SharedTimeView.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                dateTimePicker.Calendar.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
                dateTimePicker.SharedCalendar.EnableEmbeddedBaseStylesheet = grid.EnableEmbeddedBaseStylesheet
            End If
        Next
    End If
End Sub