Rad Datepicker not updating the date text in input field

15 posts, 0 answers
  1. Sandip Nandi
    Sandip Nandi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 09 Feb 2012 Link to this post

    Hi All
      I have a very strange issue, which occurs only in IE (all versions) and that too some times.
      I am using a Datepicker control, where we enter the date in the input field manually and then do a server post back, the issue  occurs randomly where the input date is not considered and it considers the previously entered date.
       
       We did a little client side debugging and found that this occurs when we enter the date manually and use a mouse to do a server postback, If we use the keyboard tab to do a server post back it this does not occurs.
       And even with mouse if we click any where in the page and then do a post back, this issue does not occurs.
      I guess this has to do with some internal telerik client side event, which is responsible for updating the datepicker, which does not fires at times.
     
       Surprisingly the error does not happens in Chrome, Firefox, Safari, Opera or any advanced browser.

    /SANDIP
  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 09 Feb 2012 Link to this post

    Hello Sandip,

    Could you paste your mark-up and code behind? Please, use the CODE FORMATTER tool of the ticket editor.

    Regards,
    Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sandip Nandi
    Sandip Nandi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 10 Feb 2012 Link to this post

    The Code for our markup will be

    &nbsp;&lt;tr id="trDateFilter" runat="server" class="DateFilterClass" style="display: none;<br>&nbsp; &nbsp; &nbsp; &nbsp; width: 100px;"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;asp:Literal ID="Literal11" runat="server" Text="&lt;%$R:lbl_DateFrom%&gt;" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;telerik:RadDatePicker ID="radMeetingFrom" runat="server" Width="150" CssClass="radMeetingFromClass"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;DateInput OnClientDateChanged="radMeetingFromOnClientDateChanged" &gt;&lt;/DateInput&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/telerik:RadDatePicker&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;asp:Literal ID="Literal4" runat="server" Text="&lt;%$R:lbl_ToDate%&gt;" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;telerik:RadDatePicker ID="radMeetingTo" runat="server" Width="150" CssClass="radMeetingToClass"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;DateInput OnClientDateChanged="radMeetingToOnClientDateChanged" &gt;&lt;/DateInput&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/telerik:RadDatePicker&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &lt;/tr&gt;



    The Server side postback code 
    &lt;asp:Button ID="btnSearch" Text="&lt;%$R:lbl_Search%&gt;" runat="server" OnClick="SearchClick"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Width="70px" /&gt;


    And on the server side we are doing usual procedures of picking the dates from two datepickers
    we also had a client side validate method associated with the SearchClick, which checks the date range and returns true, so that it can postback.

    ValidateDates = function () {
               // hiddenDateFilterClass will check if the user has selected the date option.

                if ($(".hiddenDateFilterClass").val() == "1") {
                    var selectfromdate = $(".radMeetingFromClass input").val();
                    var selectTodate = $(".radMeetingToClass input").val();
                    if (selectfromdate == "" || selectTodate == "") {
                        alert("From and To dates are required");
                        return false;
                    }
                }
            }



    as I said this error is very random in nature and occurs only few times and only in the browser IE.

    /SANDIP






  5. Sandip Nandi
    Sandip Nandi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 10 Feb 2012 Link to this post

    The Code for our markup will be

    &nbsp;&lt;tr id="trDateFilter" runat="server" class="DateFilterClass" style="display: none;<br>&nbsp; &nbsp; &nbsp; &nbsp; width: 100px;"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;asp:Literal ID="Literal11" runat="server" Text="&lt;%$R:lbl_DateFrom%&gt;" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;telerik:RadDatePicker ID="radMeetingFrom" runat="server" Width="150" CssClass="radMeetingFromClass"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;DateInput OnClientDateChanged="radMeetingFromOnClientDateChanged" &gt;&lt;/DateInput&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/telerik:RadDatePicker&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;asp:Literal ID="Literal4" runat="server" Text="&lt;%$R:lbl_ToDate%&gt;" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="left"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;telerik:RadDatePicker ID="radMeetingTo" runat="server" Width="150" CssClass="radMeetingToClass"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;DateInput OnClientDateChanged="radMeetingToOnClientDateChanged" &gt;&lt;/DateInput&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/telerik:RadDatePicker&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br>&nbsp; &nbsp; &lt;/tr&gt;



    The Server side postback code 
    &lt;asp:Button ID="btnSearch" Text="&lt;%$R:lbl_Search%&gt;" runat="server" OnClick="SearchClick"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Width="70px" /&gt;


    And on the server side we are doing usual procedures of picking the dates from two datepickers
    we also had a client side validate method associated with the SearchClick, which checks the date range and returns true, so that it can postback.

    ValidateDates = function () {
               // hiddenDateFilterClass will check if the user has selected the date option.

                if ($(".hiddenDateFilterClass").val() == "1") {
                    var selectfromdate = $(".radMeetingFromClass input").val();
                    var selectTodate = $(".radMeetingToClass input").val();
                    if (selectfromdate == "" || selectTodate == "") {
                        alert("From and To dates are required");
                        return false;
                    }
                }
            }



    as I said this error is very random in nature and occurs only few times and only in the browser IE.

    /SANDIP
     
  6. PhonDev
    PhonDev avatar
    1 posts
    Member since:
    Oct 2010

    Posted 10 Feb 2012 Link to this post

    Trying to format the code :-)

     <tr id="trDateFilter" runat="server" class="DateFilterClass" style="display: none;<br> width: 100px;">
        <
    br>        
            <
    td align="left"><br>            
                <
    asp:Literal ID="Literal11" runat="server" Text="<%$R:lbl_DateFrom%>" /><br>        
            </
    td><br>        
            <
    td align="left"><br>            
                <
    telerik:RadDatePicker ID="radMeetingFrom" runat="server" Width="150" CssClass="radMeetingFromClass"><br>                
                    <
    DateInput OnClientDateChanged="radMeetingFromOnClientDateChanged" ></DateInput><br>                <br>            
                </
    telerik:RadDatePicker><br>        
            </
    td><br>        
            <
    td align="left"><br>            
                <
    asp:Literal ID="Literal4" runat="server" Text="<%$R:lbl_ToDate%>" /><br>        
            </
    td><br>        
            <
    td align="left"><br>            
                <
    telerik:RadDatePicker ID="radMeetingTo" runat="server" Width="150" CssClass="radMeetingToClass"><br>  
                    <
    DateInput OnClientDateChanged="radMeetingToOnClientDateChanged" ></DateInput><br
               </
    telerik:RadDatePicker><br>        
            </
    td><br>        
            <
    td><br>        
            </
    td><br>   
    </
    tr>

    The Server side postback code
     
    <asp:Button ID="btnSearch" Text="<%$R:lbl_Search%>" runat="server" OnClick="SearchClick"<br>                                Width="70px" />



  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 10 Feb 2012 Link to this post

    Thanks Kenneth,

    Snadip, please, open-up a formal support ticket and attach your project files. The information provided does not give enough indication what the problem might be. Besides, you are talking about your implementation in future tense which is still more confusing.

    Thanks for that.

    Regards, Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  8. Gregory
    Gregory avatar
    15 posts
    Member since:
    Mar 2014

    Posted 20 Aug 2014 in reply to Tsvetoslav Link to this post

    Hi Tsvetoslav's

    Were you able to find what was wrong for this issue?
    I am having a similar problem. 2 radDatePickers are set to default dates when the page loads. After changing the dates, validating the form and going on to the next page, if I click the back button, the radDatePickers display the previous date changed. But if I submit the page this way, the default dates are actually passed in the code behind.
    In addition, when I have clicked my back arrow to go to the previous page and the datepicker is displayed the wanted date, a click inside the date input will change the date to the default date.

    Thank you
    Gregory
  9. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Aug 2014 in reply to Gregory Link to this post

    Hi Gregory,

    Please try the below sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadDatePicker ID="rdatepickerStartDate" runat="server" AutoPostBack="true">
    </telerik:RadDatePicker>
    <telerik:RadButton ID="rbtnNextPage" runat="server" Text="NextPage" OnClick="rbtnNextPage_Click">
    </telerik:RadButton>

    JavaScript:
    function pageLoad() {
        var date = new Date();
        var datePicker = $find("<%=rdatepickerStartDate.ClientID%>");
        if (datePicker.get_textBox().value == "") {
            datePicker.set_selectedDate(date);
        }
    }

    C#:
    protected void rbtnNextPage_Click(object sender, EventArgs e)
    {
        string date = rdatepickerStartDate.SelectedDate.ToString();
        Response.Redirect("Default.aspx", false);
    }

    Thanks,
    Princy.
  10. Gregory
    Gregory avatar
    15 posts
    Member since:
    Mar 2014

    Posted 21 Aug 2014 in reply to Princy Link to this post

    Hello Princy,

    Thank you for your answer.
    I am sure sure how this is going to work according to my scenario. I think I have not been clear. When I said the back button I meant the web browser button. Therefore there is no control such as rbtnNextPage.

    My issue is exactly the same as described on that post that I just found:
    http://www.telerik.com/forums/raddatepicker-dateinput-displays-wrong-date-when-returning-to-previous-page-in-chrome?actionMode=replyPost&postId=35e6e342-d7b2-4295-a241-e507d5f7784f

    I am going to investigate further through that post since I think it is more my case than the issue described here.

    Thank you.
    Gregory
  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Aug 2014 in reply to Gregory Link to this post

    Hi Gregory,

    I have checked the link mentioned in the above post and the solution provided in that post is working fine at my end. I have tried with 2013 Q1 version and 2014 Q2 version. Please have a look into the sample project which works fine at my end.

    Thanks,
    Princy.
  12. Gregory
    Gregory avatar
    15 posts
    Member since:
    Mar 2014

    Posted 22 Aug 2014 in reply to Princy Link to this post

    Princy,

    Thank you for the sample project. This will help to show my issue which occurs in your project.
    Simply change
    Response.Redirect("Default.aspx", false);
    for
    Response.Redirect("Default.aspx?" + RadDatePicker1.SelectedDate.Value.ToShortDateString(), false);

    In this context, I change the date to yesterday and click next page. I hit the back button of the web browser. Now the date input displays yesterday's date, but if I hit the next page button again, the Url shows default.aspx?8/22/2014.

    Please let me know if what I did is right and if you can reproduce this.

    Thank you
    Gregory
  13. Gregory
    Gregory avatar
    15 posts
    Member since:
    Mar 2014

    Posted 22 Aug 2014 in reply to Gregory Link to this post

    Princy,

    Please also add this code in DatePickerDefaultDate.aspx.cs to make more sense:
    protected void Page_Load(object sender, EventArgs e)
        {
            if(!this.IsPostBack)
                this.RadDatePicker1.SelectedDate = DateTime.Now;
        }

    Thank you :)
  14. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 27 Aug 2014 Link to this post

    Hello Gregory,

    Indeed after applying the code provided in your last two posts I was able to observed the described behavior. It seems that the value is persisted only initially but not on subsequent redirects. I have already logged this issue into our system(please visit this link) and our developers will have the care to investigate it and integrate the necessary changes in the controls.

    As a token of gratitude for reporting this problem to us I have updated your Telerik points.

    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  15. Gregory
    Gregory avatar
    15 posts
    Member since:
    Mar 2014

    Posted 27 Aug 2014 in reply to Angel Petrov Link to this post

    Hello Angel,

    Thank you for the confirmation and the points. Will it be said on that page when the fix is made to the control? Can I track it from my telerik account like I track forum posts?

    Thank you again
    Gregory
  16. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 01 Sep 2014 Link to this post

    Hi Gregory,

    We will update the status of the feedback item once our developers start working on it and once more when it is resolved. However I can not provide a certain time-frame in which the fix will be included. Considering the aforementioned I recommend monitoring the feedback item status.

    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017