This is a migrated thread and some comments may be shown as answers.
raddatepicker
1 Answer 27 Views
This is a migrated thread and some comments may be shown as answers.
Tash
Top achievements
Rank 1
Tash asked on 01 May 2012, 06:34 PM
I find that in the raddatepicker if you manually type in the date and try to access what is in the object I get 01/01/0001 instead of what was typed in. Is there some setting to set to manual typing is allowed?

1 Answer, 1 is accepted

Sort by
0
Accepted
Richard
Top achievements
Rank 1
answered on 02 May 2012, 08:36 PM
Tashfin:

You did not specify if you are accessing the typed in value on the client or in code behind.

Here's a simple sample to assist with client-side accessing of a value that is typed into the DateInput TextBox of the RadDatePicker ujsing JavaScript:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        function DisplayDateInputDate(sender, args) {
            var date = sender.get_selectedDate();
            alert(date.toDateString());
        }
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadDatePicker ID="rdpMinDate" runat="server" Width="140px" AutoPostBack="true"
            DateInput-EmptyMessage="MinDate" MinDate="01/01/1000" MaxDate="01/01/3000" DateInput-ClientEvents-OnValueChanged="DisplayDateInputDate">
        </telerik:RadDatePicker>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>

And to access the value in server-side code:

using Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
{
    protected void rdpMinDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
    {
        Label1.Text = "You selected: " + e.NewDate.Value.ToShortDateString();
    }
}

See this in action at http://screencast.com/t/WQJ3ZMRNaGX

Hope this helps!
Asked by
Tash
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or