Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Input > 2 related DatePickers

Answered 2 related DatePickers

Feed from this thread
  • Jim avatar

    Posted on Apr 1, 2009 (permalink)

    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?

    thanks!

    Reply

  • Answer Daniel Daniel admin's avatar

    Posted on Apr 2, 2009 (permalink)

    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))); 
        } 
    </script> 
     
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" ClientEvents-OnDateSelected="dateSelected" /> 
    <telerik:RadDatePicker ID="RadDatePicker2" runat="server" /> 

    Best regards,
    Daniel
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.

    Reply

  • Daniel Tharp avatar

    Posted on Feb 1, 2012 (permalink)

    Hello,

    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.

    thanks

    Reply

  • Antonio Stoilkov Antonio Stoilkov admin's avatar

    Posted on Feb 6, 2012 (permalink)

    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 >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Input > 2 related DatePickers
Related resources for "2 related DatePickers"

ASP.NET Input Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]