javascript to add number returned by combobox to date time

2 posts, 0 answers
  1. rahul
    rahul avatar
    2 posts
    Member since:
    Nov 2010

    Posted 18 Feb 2011 Link to this post

    i am facing lot of problem,i am returning number of days by combobox and i have to add into existing days,i did almost all conversion its return object type not supported by javascript,and in alert box while debugging its reurning objec,object.

    please help me out as i need this thing very soon
  2. Veli
    Veli avatar
    2002 posts

    Posted 21 Feb 2011 Link to this post

    Hello Rahul,

    Try the following code:

    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <telerik:RadComboBox ID="DaysCombo" runat="server"
                    <telerik:RadComboBoxItem Text=" " Value="0" />
                    <telerik:RadComboBoxItem Text="1 day" Value="1" />
                    <telerik:RadComboBoxItem Text="2 days" Value="2" />
                    <telerik:RadComboBoxItem Text="3 days" Value="3" />
                    <telerik:RadComboBoxItem Text="4 days" Value="4" />
            <telerik:RadDateTimePicker ID="Picker1" runat="server" SelectedDate="02/21/2011">
            <script type="text/javascript">
                function daysComboChanged(sender, args)
                    var days = +args.get_item().get_value();
                    var picker = $find('<%= Picker1.ClientID %>');
                    var date = new Date();
                    date.setDate(date.getDate() + days);

    the Telerik team
Back to Top