Hi,
We are trying to change the color of the filterItem when there is a filter in
the grid(dynamicaly created). It all seems to work fine but when one of the
grid columns is filtered with the "Is Empty" function the color does not apply.
The code works fine and if a column is using a filterTemplate this column has
the color applied correctly but the color is ignored by the other columns.
Here is the code that we use to make the filterItem change color when filter is applied :
using System;using System.Collections;using System.IO;using System.Web.UI;using CommonTools;using Telerik.Web.UI;namespace CCO.Fortress.MainWebApplication.Library.Helpers{ private void OnPageLoadComplete(object sender, EventArgs e) { FortressGrid.MasterTableView.AllowMultiColumnSorting = true; GridItem[] gridFilteringItems = FortressGrid.MasterTableView.GetItems(GridItemType.FilteringItem); if (gridFilteringItems.Length > 0) { GridFilteringItem filteringItem = (GridFilteringItem)gridFilteringItems[0]; foreach (GridColumn column in FortressGrid.MasterTableView.Columns) { if (column.CurrentFilterValue != string.Empty) { Control control = filteringItem[column.UniqueName].Controls[0]; if(control is WebControl) { ((WebControl)control).BackColor = Color.PaleTurquoise; } } } } }
}
<
asp:TemplateField meta:resourcekey="TemplateField3">
<EditItemTemplate>
<radCln:RadDatePicker ID="txtPriceValidFrom" runat="server" DbSelectedDate='<%# Bind("ValidFrom") %>' ControlContext="Product" RequiredPermission="EditProduct">
<Calendar ID="Calendar3" runat="server">
<SpecialDays>
<radCln:RadCalendarDay Repeatable="Today" Date="">
<ItemStyle CssClass="radCalendarTodayBackground" />
</radCln:RadCalendarDay>
</SpecialDays>
</Calendar>
<DateInput CssClass="TextBoxDays"></DateInput>
<PopupButton CssClass="radPopupImage" ImageUrl="~/images/icons/calendar.gif" HoverImageUrl="~/images/icons/calendar.gif"></PopupButton>
</radCln:RadDatePicker>
</EditItemTemplate>
<HeaderTemplate>
<asp:Label runat="server" Text="Valid from" ID="lblValidFromHeader" meta:resourceKey="Label31"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server" Text='<%# Bind("ValidFrom") %>' ID="lblValidFrom" meta:resourceKey="lblValidFrom"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<
asp:TemplateField meta:resourcekey="TemplateField4">
<EditItemTemplate>
<radCln:RadDatePicker ID="txtPriceValidTo" runat="server" DbSelectedDate='<%# Bind("ValidTo") %>'
ControlContext="Product" RequiredPermission="EditProduct">
<Calendar ID="Calendar4" runat="server">
<SpecialDays>
<radCln:RadCalendarDay Repeatable="Today" Date="">
<ItemStyle CssClass="radCalendarTodayBackground" />
</radCln:RadCalendarDay>
</SpecialDays>
</Calendar>
<DateInput CssClass="TextBoxDays">
</DateInput>
<PopupButton CssClass="radPopupImage" ImageUrl="~/images/icons/calendar.gif" HoverImageUrl="~/images/icons/calendar.gif">
</PopupButton>
</radCln:RadDatePicker>
</EditItemTemplate>
<HeaderTemplate>
<asp:Label runat="server" Text="Valid until" ID="lblValidUntil" meta:resourceKey="Label32"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server" Text='<%# Bind("ValidTo") %>' ID="lblValidTo" meta:resourceKey="lblValidTo"></asp:Label>
</ItemTemplate>
<ItemStyle VerticalAlign="Middle" />
</asp:TemplateField>

<telerik:RadToolTip ID="radToolTipLogin" runat="server" ContentScrolling="Auto" TargetControlID="btnMore"HideEvent="ManualClose" Width="500px" Height="203px" RelativeTo="Element" Position="BottomCenter"EnableShadow="true" ShowEvent="OnClick" RenderInPageRoot="true"> <%# Eval("LOGIN") %></telerik:RadToolTip>