DatePicker Popup - highlight date

6 posts, 0 answers
  1. jgig
    jgig avatar
    61 posts
    Member since:
    Apr 2008

    Posted 15 Jan 2010 Link to this post

    I have a RadDatePicker in a Repeater, when I enter a date in the first rows datepicker I take that date and add 5 days in the next rows calendar popup. I did this so it highlighted the date for you. (popup.selectDate(dateTriplet, true);)

    The problem is when the user looks at that 2nd rows calendar popup, they see that date highlighted (which really means selected) and if that is the date they want they have to click it twice using the popup, once to unselect it and then to select it again.

    Is there an way on the client to hightlight the date but not select it. I saw that you can add "special days" but that has to be done on the server side from what I understand.

    thanks!
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 19 Jan 2010 Link to this post

    Hello jgig,

    In order to achieve your goal, you can try handling the RadCalendar DayRender client-side event and it is done here.
    Another option is to try using the OnDateClick/OnDateSelected events for your purpose. There you can check if a date is already selected and cancel its deselection or set is as selected again.

    Give it a try and let me know how it goes.

    All the best,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. jgig
    jgig avatar
    61 posts
    Member since:
    Apr 2008

    Posted 21 Jan 2010 Link to this post


    I tried this and it displays fine but when I mouse over it the style changes and it never gets set back when you mouse off of it. I looked at this http://demos.telerik.com/aspnet-ajax/calendar/examples/programming/customdaycellrendering/defaultcs.aspx and it appears to work fine, not sure what I am doing differently. My calendar is loaded is modified during an ajax call also...not sure that has any impact.

    protected void rcMultiMonth_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {
    if(Met Some Criteria){e.Cell.Style["border"] = "solid 1px #85c843";}
    }

    Any ideas?
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 22 Jan 2010 Link to this post

    Hi jgig,

    Are you using RadAjax to ajaxify the problematic RadCalendar? If so, try replacing it with MS UpdatePanel and see if the issue persists.
    Additionally, I suggest that you send me a sample page illustrating your scenario and setup. I will try debugging it locally and see what could have gone wrong there.

    All the best,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. jgig
    jgig avatar
    61 posts
    Member since:
    Apr 2008

    Posted 22 Jan 2010 Link to this post

    you are right, I just changed it to an MS UpdatePanel and that fixed it. I have a pretty complex page that uses this multi month calendar like a date picker I saw below, so I can't keep it as a UpdatePanel:

    How would I fix the RadAjax to work like an UpdatePanel for this? thanks!
  6. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Jan 2010 Link to this post

    Hi jgig,

    I am afraid that  it is a known issue that styles applied on RadCalendar days in the DayRender event are lost after ajax request when the Calendar is ajaxified with RadAjax. We are searching for a resolution on this issue however still with no results.
    In order the styles to be persisted in such case, you could try adding the styled days into the SpecialDays collection of the Calendar on Page_Load instead of styling the days on DayRender event.

    Check it out and let me know if this works for you.

    Sincerely yours,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top