set date on change

5 posts, 1 answers
  1. STEPHEN
    STEPHEN avatar
    13 posts
    Member since:
    Sep 2010

    Posted 16 Sep 2010 Link to this post

    How do I set the date selected in txPayDate to txtPaydate1 on change?  For example I have this:

    <telerik:RadDatePicker ID="txtPayDate" Runat="server" OnDateSelected="OnDateSelected">
                    </telerik:RadDatePicker>
    <telerik:RadDatePicker ID="txtPayDate1" Runat="server" >
                    </telerik:RadDatePicker>

    I tried this in javascript:

        function OnDateSelected(sender, e)  
    {                                    
            var dateInput = $find('<%= txtPayDate1.ClientID %>');
            dateInput.set_value(args.get_newDate().format("MM/dd/yyyy"));
     
    }  

    I tried this in code behind:

     txtPayDate1.DateInput.SelectedDate = txtPayDate.DateInput.SelectedDate

    a few hours on something that would take me 10 seconds in access.
  2. Answer
    Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 16 Sep 2010 Link to this post

    Hello Stephen,

    You can use client-side code to accomplish this:
    <script type="text/javascript">
        function selectDate(sender, args)
        {
            $find('<%= txtPayDate1.ClientID %>').set_selectedDate(args.get_newDate());
        }
    </script>
    <telerik:RadDatePicker ID="txtPayDate" runat="server">
        <ClientEvents OnDateSelected="selectDate" />
    </telerik:RadDatePicker>
    <telerik:RadDatePicker ID="txtPayDate1" runat="server">
    </telerik:RadDatePicker>

    I hope this helps.

    Regards,
    Daniel
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Anzar
    Anzar avatar
    62 posts
    Member since:
    Sep 2012

    Posted 11 Jan 2013 Link to this post

    Hi,
    How to get year from selected date on 'OnDateSelected' client side event.


    Thanks & Regards
    Anzar.M
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Jan 2013 Link to this post

    Hi

    Try the following javascript to achieve your scenario.
    JS:
    function OnDateSelected(sender, args) {
            var date=sender.get_dateInput().get_selectedDate();
            alert(date.getFullYear());
        }

    Thanks,
    Princy
  6. Anzar
    Anzar avatar
    62 posts
    Member since:
    Sep 2012

    Posted 11 Jan 2013 Link to this post

    Hi Princy,
    Thanks . Its working properly.

    Thanks & Regards
    Anzar.M
    SBN // Technologics
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017