This is a migrated thread and some comments may be shown as answers.
RadDateInput Auto correcting to the wrong date
3 Answers 17 Views
This is a migrated thread and some comments may be shown as answers.
glenn22
Top achievements
Rank 1
glenn22 asked on 31 Mar 2011, 08:35 PM
I have an odd problem occurring in a program I wrote some time ago. It uses the RadDateInput control. When i enter a date of "4/4/2011" is automatically changes it to "5/4/2011". It seems to do this on other months as well, but not all. Any idea why this would happen?

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 06 Apr 2011, 09:37 AM
Hello,

This is not the default behavior of the control, as you can see in our demos. It is possible that some javascript changes the behavior of the input, or an inappropriate format string. It would be anyway hard to determine what is going on without looking at your code.

Regards,
Tsvetina
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
0
glenn22
Top achievements
Rank 1
answered on 06 Apr 2011, 02:48 PM

Here is the code that produced the problem. This page has been running for more than a year without a problem, now seems to be changing the month for not apparently reason.

<% @Import Namespace="System.Data" %>
<% @Import Namespace="System.Data.SqlClient" %>
<%@ Page Language="VB" Debug="true"  %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Namespace="Telerik.WebControls" TagPrefix="radI" Assembly="RadInput.Net2"%>
<link href="../style.css" rel="stylesheet" type="text/css" />
<title> S&R Shift Schedule - Add a Schedule </title>
<script language="javascript">
          
        function UpdateSecondPicker()
        {           
            var picker1 = <%= fromdate.ClientID %>;
            var picker2 = <%= todate.ClientID %>;
              
            var date = picker1.GetDate();
            date.setDate(date.getDate() + 4);
              
            picker2.SetDate(date);
        }
</script>
<script language="javascript"
    Telerik.Web.UI.RadDateInput.prototype.parseDate = function (value, baseDate)   
    {   
        
    }   
</script>  
  
  
<script runat="server">
  
          
  
  
        Private Sub addtodbase(ByVal sender As System.Object, ByVal e As System.EventArgs)
                    if ( todate.selecteddate= "" or fromdate.selecteddate="" or Request.form("amill") = "" or Request.form("bmill") = "" or Request.form("cmill") = "" or Request.form("dmill") = "" or Request.form("emill") = "" or Request.form("smill") = "" or Request.form("pmill") = "") and Request.form("cbLive") = "on" then
  
                Session("error") ="Required fields left blank!"
                Session("firstvisit2") = ""
                Session("savefromdate") = Request.form("fromdate")
                Session("savetodate") = Request.form("todate")
                Session("saveamill") = Request.form("amill")
                Session("savebmill") = Request.form("bmill")
                Session("savecmill") = Request.form("cmill")
                Session("savedmill") = Request.form("dmill")
                Session("saveemill") = Request.form("emill")
                Session("savesmill") = Request.form("smill")
                Session("savepmill") = Request.form("pmill")
                Session("saveamillcomm") = Request.form("amillcomm")
                Session("savebmillcomm") = Request.form("bmillcomm")
                Session("savecmillcomm") = Request.form("cmillcomm")
                Session("savedmillcomm") = Request.form("dmillcomm")
                Session("saveemillcomm") = Request.form("emillcomm")
                Session("savesmillcomm") = Request.form("smillcomm")
                Session("savepmillcomm") = Request.form("pmillcomm")
                Session("savegencomm") = Request.form("generalcomm")
                Session("savecbLive") = Request.form("cbLive")
                response.redirect("addschedule.aspx")
     else
            if (fromdate.selecteddate = "" or todate.selecteddate = "") then
                Session("error") ="Required fields left blank!"
                Session("firstvisit2") = ""
                Session("savefromdate") = Request.form("fromdate")
                Session("savetodate") = Request.form("todate")
                Session("saveamill") = Request.form("amill")
                Session("savebmill") = Request.form("bmill")
                Session("savecmill") = Request.form("cmill")
                Session("savedmill") = Request.form("dmill")
                Session("saveemill") = Request.form("emill")
                Session("savesmill") = Request.form("smill")
                Session("savepmill") = Request.form("pmill")
                Session("saveamillcomm") = Request.form("amillcomm")
                Session("savebmillcomm") = Request.form("bmillcomm")
                Session("savecmillcomm") = Request.form("cmillcomm")
                Session("savedmillcomm") = Request.form("dmillcomm")
                Session("saveemillcomm") = Request.form("emillcomm")
                Session("savesmillcomm") = Request.form("smillcomm")
                Session("savepmillcomm") = Request.form("pmillcomm")
                Session("savegencomm") = Request.form("generalcomm")
                Session("savecbLive") = Request.form("cbLive")
                response.redirect("addschedule.aspx")
            end if      
               DIM Connection as New SqlConnection
               DIM oRS as SqlDataReader
               DIM oRS2 as SqlDataReader
                DIM qry as New SqlCommand
                DIM qry2 as New SqlCommand
                DIM maxnumber as integer
                  
                Session("addschedule") = ""
                Session("firstvisit") = ""
                Session("firstvisit2") = ""
                Session("savefromdate") = ""
                Session("savetodate") = ""
                Session("saveamill") = ""
                Session("savebmill") = ""
                Session("savecmill") = ""
                Session("savedmill") = ""
                Session("saveemill") = ""
                Session("savesmill") = ""
                Session("savepmill") = ""
                Session("saveamillcomm") = ""
                Session("savebmillcomm") = ""
                Session("savecmillcomm") = ""
                Session("savedmillcomm") = ""
                Session("saveemillcomm") = ""
                Session("savesmillcomm") = ""
                Session("savepmillcomm") = ""
                  
                qry2.CommandText = "select Max(scheduleid) as maxnum from shiftschedule"
                  
                Connection = New System.Data.SQLClient.SQLConnection ("server=172.20.72.251; initial catalog=workorder;uid=workuser;pwd=")
                Connection.open()
                  
                qry.Connection = Connection
                qry2.Connection = Connection
                                  
                oRS2 = qry2.ExecuteReader()
                  
                if oRS2.Read() then
                        maxnumber = oRS2("maxnum") + 1
                end if
                  
                Connection.Close
                  
              
                        Session("fromdate") = fromdate.SelectedDate
                        Session("fromdate2") = Request.Form("fromdate")
                        Session("todate") = todate.SelectedDate
                        Session("todate2") = Request.Form("todate")
                  
                  
                If Request.form("cblive") = "on" then 
                        session("liveswitch") = "1"
                else
                        session("liveswitch") = "0"
                end if
                  
                qry.CommandText = "Insert into shiftschedule (scheduleid, datefrom, dateto, a_mill, a_mill_comments, b_mill, b_mill_comments, c_mill, c_mill_comments, d_mill, d_mill_comments, e_mill, e_mill_comments, s_mill, s_mill_comments, p_mill, p_mill_comments,gencomm,live,revised) values('" & maxnumber & "', '" & Session("fromdate") & "', '" & Session("todate") & "', '" & Request.Form("amill") & "', '" & Request.Form("amillcomm") & "', '" & Request.Form("bmill") & "', '" & Request.Form("bmillcomm") & "', '" & Request.Form("cmill") & "', '" & Request.Form("cmillcomm") & "', '" & Request.Form("dmill") & "', '" & Request.Form("dmillcomm") & "', '" & Request.Form("emill") & "', '" & Request.Form("emillcomm") & "', '" & Request.Form("smill") & "', '" & Request.Form("smillcomm") & "', '" & Request.Form("pmill") & "', '" & Request.Form("pmillcomm") & "', '" & Request.Form("generalcomm") & "' , '" & Session("liveswitch") & "',0)"
  
                Connection.Open()
                oRS = qry.ExecuteReader()
                  
                end if
  
                Response.redirect("admin.aspx")
        End Sub
</script>
<body>
<center><img src="../SRLOGOCO2.JPG" width="184" height="150" alt=""><BR><BR><font color="red" size="-1">* <i>= Required to make live</i></font><BR>
<% 
'if User.IsInRole("SRS-LOCAL\SchedUsers")= False Then
'   Response.Redirect("../sschedule.aspx")
'end if
  
if Session("error") <> "" then
            Response.write("<Font color='red'><b> " & Session("error") & " </b></font>")
    Session("error") = ""
end if
  
  
%>
<form method="post" action="addschedule.aspx" name="testform" runat="server">
  
<font size="-1">
  
<table cellspacing="0" cellpadding="5">
<tr>
    <td><font size="-1">Make Live? </font> </td>
    <td colspan=3>
    <asp:CheckBox ID="cbLive" runat="server"></asp:CheckBox>
    </td>
</tr>
<tr>
    <td><font size="-1">From Date(MM/DD/YYYY): </font></td>
    <td colspan=3><radI:RadDateInput id="fromdate" style="FONT: 8pt monospace" runat="server" Skin="mac"                        autocompletetype="Disabled" DateFormat="MM/dd/yyyy" width="100px">
                                <ClientEvents OnValueChanged="UpdateSecondPicker" />
                                </radI:RadDateInput></td>
</tr>
<tr>
    <td><font size="-1">To Date(MM/DD/YYYY): </font></td>
    <td colspan=3><radI:RadDateInput id="todate" style="FONT: 8pt monospace" runat="server" Skin="mac"
                                width="100px"></radI:RadDateInput>   
    </td>
</tr>
<tr>
    <td><font size="-1">A-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='amill' size=3 maxlength=3 value='" & Session("saveamill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='amillcomm' size=50 maxlength=60 value='" & Session("saveamillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">B-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='bmill' size=3 maxlength=3 value='" & Session("savebmill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='bmillcomm' size=50 maxlength=60 value='" & Session("savebmillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">C-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='cmill' size=3 maxlength=3 value='" & Session("savecmill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='cmillcomm' size=50 maxlength=60 value='" & Session("savecmillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">D-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='dmill' size=3 maxlength=3 value='" & Session("savedmill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='dmillcomm' size=50 maxlength=60 value='" & Session("savedmillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">E-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='emill' size=3 maxlength=3 value='" & Session("saveemill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='emillcomm' size=50 maxlength=60 value='" & Session("saveemillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">S-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='smill' size=3 maxlength=3 value='" & Session("savesmill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='smillcomm' size=50 maxlength=60 value='" & Session("savesmillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">P-Mill will be on: </font></td>
    <td><% Response.write("<input type='text' name='pmill' size=3 maxlength=3 value='" & Session("savepmill") & "'  />")%><font color="red" size="-1">*</font></td>
    <td><font size="-1">Comments: </font></td>
    <td><% Response.write("<input type='text' name='pmillcomm' size=50 maxlength=60 value='" & Session("savepmillcomm") & "'  />")%></td>
</tr>
<tr>
    <td><font size="-1">General Comment: </font></td>
    <td colspan="3"><% Response.write("<input type='text' name='generalcomm' size=50 maxlength=60 value='" & Session("savegencomm") & "'  />")%></td>
</tr>
</table></font><BR>
<asp:button runat="server" onClick="addtodbase" text="Add Schedule" /><BR><BR>
<table cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="4"><img src="../images/top_bg_links_left.gif" width="4" height="4" alt="" /></td>
                        <td style="background:url(../images/top_bg_links.gif) repeat-x"></td>
                        <td><img src="../images/top_bg_links_right.gif" width="4" height="4" alt="" /></td>
                      </tr>
                      <tr>
                        <td style="background:url(../images/left_bg_links.gif) repeat-y"></td>
                        <td align="center" bgcolor="#f8f8f8"><a href="admin.aspx" class="links_highlight">Back to Admin </a></td>
                        <td bgcolor="#f8f8f8" style="background:url(../images/right_bg_links.gif) repeat-y"></td>
                      </tr>
                      <tr>
                        <td width="4" height="4"><img src="../images/bottom_bg_left_links.gif" width="4" height="4" alt="" /></td>
                        <td style="background:url(../images/bottom_bg_links.gif) repeat-x"></td>
                        <td width="4"><img src="../images/bottom_bg_right_links.gif" width="4" height="4" alt="" /></td>
                      </tr>
     </table>
</form>
</body>
</html>
0
Tsvetina
Telerik team
answered on 11 Apr 2011, 09:07 AM
Hello,

It is certain that we have not made any changes to the controls from the ASP.NET Classic suite since last year, so if there is any change in the behavior of the control, it should be due to some other configuration specific. I tested this with the new RadControls and setting value 4/4/2011 resulted in this exact date appearing in the date input.

Have you tried debugging the values in the javascript of the UpdateSecondPicker method?

Kind regards,
Tsvetina
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
Asked by
glenn22
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
glenn22
Top achievements
Rank 1
Share this question
or