2 related DatePickers

4 posts, 1 answers
  1. Jim
    Jim avatar
    12 posts
    Member since:
    Oct 2008

    Posted 01 Apr 2009 Link to this post

    Hi there,

    I have 2 RadDatePicker controls on a page.  When a user picks a date from the first one, I want the second one to show a date that's one month later than the first one.

    I am not having much success doing this.  Could you guys throw together a quick example that illustrates this?

  2. Answer
    Daniel avatar
    4933 posts

    Posted 02 Apr 2009 Link to this post

    Hello Jim,

    Please try the following:
    <script type="text/javascript" language="javascript"
        function dateSelected(sender, args) 
            var picker2 = $find('<%= RadDatePicker2.ClientID %>'); 
            var selDate = sender.get_selectedDate(); 
            picker2.set_selectedDate(new Date(selDate.setMonth(selDate.getMonth() + 1))); 
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" ClientEvents-OnDateSelected="dateSelected" /> 
    <telerik:RadDatePicker ID="RadDatePicker2" runat="server" /> 

    Best regards,
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
  4. Daniel Tharp
    Daniel Tharp avatar
    13 posts
    Member since:
    May 2006

    Posted 01 Feb 2012 Link to this post


    I have 2 raddatepickers in a repeater control and I want to do the same thing as you mention. How would I access the other raddatepicker inside the repeater. I looked at the client object but I don't understand how to get the parent control and index so I can get to the other datepicker. Any help would be great.

  5. Antonio Stoilkov
    Antonio Stoilkov avatar
    530 posts

    Posted 06 Feb 2012 Link to this post

    Hi Daniel,

    You could achieve your scenario by getting the naming container prefix and appending it to the second RadDatePicker id as it is shown in the example below.
    var namingContainer = sender.get_id().substring(0, sender.get_id().search("RadDatePicker1"));
    var radDatePicker2 = $find(namingContainer + "RadDatePicker2");

    Kind regards,
    Antonio Stoilkov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top