This is a migrated thread and some comments may be shown as answers.

Highlight date in griddatefilter

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 23 Nov 2012, 11:54 AM
Hi there,
     How do I highlight todays date in grid date filter. thanks for the help
Savyo

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Nov 2012, 11:56 AM
Hi,

Here is the sample code I tried to show special day in grid date filter as today's date.

ASPX:
<telerik:GridDateTimeColumn  DataField="OrderDate" HeaderText="OrderDate" UniqueName="OrderDate" PickerType="DatePicker"   DataFormatString="{0:d}" DataType="System.DateTime"></telerik:GridDateTimeColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridFilteringItem)
    {
        GridFilteringItem fitem = (GridFilteringItem)e.Item;
        RadDatePicker pic = (RadDatePicker)fitem["OrderDate"].Controls[0];
        RadCalendarDay NewDay = new RadCalendarDay();
        NewDay.Repeatable = RecurringEvents.Today;
        NewDay.ItemStyle.BackColor = System.Drawing.Color.RoyalBlue;
        pic.SharedCalendar.SpecialDays.Add(NewDay);  
    }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Savyo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or