Highlight current date in calendar of grid filter date picker

5 posts, 1 answers
  1. madu
    madu avatar
    17 posts
    Member since:
    Nov 2010

    Posted 23 Dec 2010 Link to this post

    Hi All,

    I am using rad grid with filtering (AllowFilteringByColumn="true").
    I have "GridDateTimeColumn" with header filter.
    What I want to do is to highlight the current date in calendar of grid filter date picker.
    How can I do this?
    I have used following to access the date picker, But it did not work.
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridFilteringItem)
            {
                GridFilteringItem item = e.Item as GridFilteringItem;
                RadDatePicker picker = item.FindControl("RadDatePicker1") as RadDatePicker;
            }
        }

    Please give me a solution.

    Thanks & Regards,
    Madu
  2. madu
    madu avatar
    17 posts
    Member since:
    Nov 2010

    Posted 27 Dec 2010 Link to this post

    Hi All,

    Any Solution Pls......
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 27 Dec 2010 Link to this post

    Hi Madu,

    Try using the following code:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadCalendar calendar = (RadCalendar)RadGrid1.FindControl("gdtcSharedCalendar");
     
        RadCalendarDay day = new RadCalendarDay();
        day.Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.Today;
        day.ItemStyle.CssClass = "rcToday";
        calendar.SpecialDays.Add(day);
    }

    Best wishes,
    Pavel
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  5. madu
    madu avatar
    17 posts
    Member since:
    Nov 2010

    Posted 27 Dec 2010 Link to this post

    Hi Pavel,
    Thank You very much for your reply and I modified it as follows and it works fine.
    Thanks a lot.
     
    protected void RadGrid2_ItemCreated(object sender, GridItemEventArgs e)
           {
               if (e.Item is GridFilteringItem)
               {
                   RadCalendar calendar = (RadCalendar)RadGrid2.FindControl("gdtcSharedCalendar");
     
                   RadCalendarDay day = new RadCalendarDay();
                   day.Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.Today;
                   day.ItemStyle.CssClass = "rcToday";
                   calendar.SpecialDays.Add(day);
     
               }
           }

    Regards,
    Madu

  6. Marc Fearby
    Marc Fearby avatar
    14 posts
    Member since:
    Aug 2012

    Posted 09 May 2011 Link to this post

    Thanks, Madu. Glad I found this post. I could only get your item_created method working, not the provided solution. No big deal, just glad it works. Here's the VB.NET for anyone interested:

    Protected Sub MyGrid_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles gridApprovedForms.ItemCreated

            If TypeOf e.Item Is Telerik.Web.UI.GridFilteringItem Then

                Dim calendar As Telerik.Web.UI.RadCalendar = DirectCast(MyGrid.FindControl("gdtcSharedCalendar"), Telerik.Web.UI.RadCalendar)

                Dim day As New Telerik.Web.UI.RadCalendarDay()
                day.Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.Today
                day.ItemStyle.CssClass = "rcToday"
                calendar.SpecialDays.Add(day)

            End If

        End Sub
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017