+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Radcalendar: Search date and bold it.

Radcalendar: Search date and bold it.

7 posts, 0 answered
  1. Babu Raghu
    Babu Raghu avatar
    10 posts
    Registered:
    29 Mar 2010
    15 Apr 2010
    Link to this post
    Hi,

    I have a radcalendar in my parent form and returning date from the dialog window. When I returning the date from the child page I need to bold that particular date on my parent page radcalendar.

    If I took that particular cell then I can do it. I am trying to find it :-)

    Please help me out to resolve this.

    Thanks in advance.
    Regards,
    Babu R
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Apr 2010
    Link to this post
    Hello Babu Raghu,

    You could subscribe for SelectionChanged and pass the date to the collection of the SelectedDates.

    void RadCalandar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
    {
         
        RadDate d = new RadDate(DateTime.Now);
        e.SelectedDates.Add(d);    
    }

    if you are working on with the client side API you could use OnDateSelected="OnDateSelected"
    sample

    function OnDateSelected(sender, e) {
            var todaysDate = new Date();
            var todayTriplet = [todaysDate.getFullYear(), todaysDate.getMonth() + 1, todaysDate.getDate()];
            sender.selectDate(todayTriplet, true);
            alert(sender.get_selectedDates());
        }


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Babu Raghu
    Babu Raghu avatar
    10 posts
    Registered:
    29 Mar 2010
    16 Apr 2010
    Link to this post
    Hi,

    I dont want do any actions ondateselected event. I just want to find the date in radcalendar and bold it.

    Thanks & Regards,
    Babu R
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Apr 2010
    Link to this post
    Hello Babu Raghu,

    You can do this in DayRender

    void RadCalandar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {
        var monthStart = e.View.MonthStartDate;
        var monthEnd = e.View.MonthEndDate; 
               
                 //THIS IS THE DATE TIME OBJECT THAT WE ARE LOOKING FOR
     var obj = (DateTime)cnt.GetMetaData("Publication_Date");
                if (e.Day.Date.Day == obj.Day && e.Day.Date.Month == obj.Month)
                {
                          // SET SOME BORDER TO THE CELL. FROM THE ARGUMENT
                          //YOU COULD ACCESS THE DAY OR CELL
                    e.Cell.BorderColor = System.Drawing.Color.Yellow;
     
                }
    }



    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Babu Raghu
    Babu Raghu avatar
    10 posts
    Registered:
    29 Mar 2010
    16 Apr 2010
    Link to this post
    Hi,

    I am sorry to say this the above code wont work for my requirement.

    Here is my requirement
    1. I want to iterate the radcalendar. How do I do that? like this = (for var i=0;i<radcalendar.length;i++)  ??
    2. Once I found my date I need to bold that particular date cell.

    Thats it.

    Thanks in advance.

    Regards,
    Babu R
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Apr 2010
    Link to this post
    Hello Babu Raghu,

    The code that I sent you shows how to find the date from the calendar. Please observe the samples. You could also take a look at RadCalendar API overview to gather how to control works.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Rohan
    Rohan avatar
    1 posts
    Registered:
    21 May 2007
    16 Jan 2012
    Link to this post
    Hi I have the same problem as Babu. I have a list of dates in a data object. This data object is populated on the page load and contains a list of dates plus other information. For example: "available", "unavailable", "tentative". I want to mark the calendar days depending on these values.

    Yet it seems difficult to simply find a date as an item and then work with it as, say a RadCalendar item (by iterating through each item displayed in the calendar, for example).

    DayRender is not appropriated because it assumes that all the information is currently on hand  at the time of the Calendar's render cycle. It does not consider the situation where the days need to be compared with a separate resource heavy dataobject which needs to be built at run time (unless I am missing something).

    I would have thought an obvious need for this control (it's traditional with other telerik controls) is be able to iterate through each item in the control and perform functions on it as required (perhaps based on a dataobject like above). Or, there doesn't even seem to be a way of achieving:
    var mydate = RadCalendar.FindDate(date_in)
    mydate.cssclass="changeclass"

    RadCalendar1.SelectedDates.Add(Date_in) is mildy useful when dealing with boolean values, but not conditional values which could produce several outcomes.

    There may be ways to do this all, but from my hours of testing and documentation reading I haven't been able to establish it.

    The current solution that I'm thinking is to create the separate dataobject (list of dates) before the rendering of the calendar, store it in a session, then on the DayRender event which occurs in the Clalendar rendering refer to the stored datasource in which has been placed in a session - which seems to be a very shotty way of doing it. The datasource would be resource draining and really should only be produced once, and then discarded.

    Would love any advice. Thanks.
Register for webinar
7 posts, 0 answered