This is a migrated thread and some comments may be shown as answers.

RadDatePicker's method _setInputDate don't works in Mozilla correctly.

1 Answer 36 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Andrew Newton
Top achievements
Rank 1
Andrew Newton asked on 24 Aug 2009, 02:20 PM

Hi. I'm working with Sitefinity and using there two RadDatePickers. I need to have next action 

1. Select date in the first raddatepicker.

2. Set selected date in the 2-d raddatepicker = 1-t raddatepicker date + 1 day using client side javascript

In IE and Opera it works pretty good ,but in Mozilla have problems. Whenexecuting event _setInputDate raizes validation and no data selected. I have tried to set DateInput-CausesValidation="false" ,but nothing happends with and without this attribute.

Here the code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="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">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div> 
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>  
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

<script type="text/javascript">  
function dateSelected(sender, args) {
var datePicker = $find("<%= InprDeparture.ClientID %>");
var date = args._newDate;
datePicker._setInputDate(new Date(date.getYear(), date.getMonth(), date.getDate() + 1));
}  
</script>


</telerik:RadCodeBlock>  

<h5>Arrival</h5>
<telerik:RadDatePicker ID="InprArrival" Style="vertical-align: middle;" Width="160px" MinDate="2006-02-01" runat="server" MaxDate="2099-12-16">
<ClientEvents OnDateSelected="dateSelected" />
</telerik:RadDatePicker>

<h5>Departure</h5>
<telerik:RadDatePicker DateInput-CausesValidation="false" ID="InprDeparture" Style="vertical-align: middle;" Width="160px" MinDate="2006-02-01" runat="server" MaxDate="2099-12-16" >  
</telerik:RadDatePicker>
<telerik:RadCalendar></telerik:RadCalendar>  
</div>
</form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 27 Aug 2009, 07:39 AM
Hi Andrew,

The problem is caused by a browser inconsistency and incorrect usage of the Javascript Date Object API. Please refer to:

http://www.w3schools.com/jsref/jsref_getYear.asp

http://www.w3schools.com/jsref/jsref_getFullYear.asp


By the way, _SetInputDate is not a public method of the RadDatePicker. Please use this instead:

datePicker.get_dateInput().set_selectedDate( .... );


Best wishes,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar
Asked by
Andrew Newton
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or