RadDatePicker value

2 posts, 0 answers
  1. Darryl
    Darryl avatar
    3 posts
    Member since:
    Aug 2011

    Posted 25 Oct 2011 Link to this post


    I'm having problems getting the value of RadDatePicker and using that value as an input for my SQL statement.  The query works if I replace the variables to normal values.

    Here is my code snippet.

    <asp:SqlDataSource ID="SqlDataSource" runat="server"
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
            SelectCommand="SELECT column, column, column, column, column
    FROM table A, table B
    WHERE (A.ACCEPTANCE_DATE >= TO_DATE(:fromDate, 'dd-mon-yyyy'))
    AND (A.ACCEPTANCE_DATE <= TO_DATE(:toDate, 'dd-mon-yyyy'))
    AND column = column
    AND (column LIKE 'A')
    ORDER BY column, column">
                <asp:ControlParameter ControlID="radDatePickerFrom" Name="fromDate" />
                <asp:ControlParameter ControlID="radDatePickerTo" Name="toDate" />
  2. Vasil
    Vasil avatar
    1640 posts

    Posted 28 Oct 2011 Link to this post

    Hello Darryl,

    You should use the same format when parsing the date as the DataFormat used in the DateInput.
    Currently you are using "dd-mon-yyyy" which means that the TO_DATE expects date like: "28 Oct. 2011" However, your datepicker could give the date like: "10/28/2011" if you used the "dd/MM/yyy" format for it.
    Make sure that you use the same format for the DateInput of the Picker and for your sql statement.
    Check this help resources:

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top