Contact Sales: +1-888-365-2779
Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Calendar > RadDatePicker Autopostback bug?
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered RadDatePicker Autopostback bug?

Feed from this thread
  • John Waters Intermediate avatar

    Posted on Jan 2, 2007 (permalink)

    I noticed that in the new version of the RadDatePicker you have added an AutoPostback property. However, once it has been changed once, it seems that it ALWAYS fires whenver you tab out of the date input. I.e after the initial auto postback, it posts back every time you tab through it after that, even if no change is made.

  • Giuseppe Giuseppe admin's avatar

    Posted on Jan 3, 2007 (permalink)

    Hello John,

    Thank you for contacting us.

    We were unable to reproduce the problematic behavior. Please review the attached sample application and let us know how we could observe the erroneous issue.

    Looking forward to your reply.


    Regards,
    Manuel
    the telerik team
    Attached files

  • Posted on Aug 13, 2009 (permalink)

    Hi,
    I ended up here by searching:
    http://www.telerik.com/search.aspx?start=0&client=telerik&q=RadDatePicker%2bAutoPostBack

    First result is this thread: I have exactly the same problem.

    It's weird you couldn't repro the issue. Are you using last version?

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="datepicker.aspx.vb" Inherits="import_datepicker" %> 
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title>Untitled Page</title> 
    </head> 
    <body> 
    <form id="form1" runat="server"
    <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager> 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
        <script type="text/javascript"
        function mngRequestStarted(ajaxManager, eventArgs) 
        { 
          if(eventArgs.EventTarget == "excelLink") 
          { 
             eventArgs.EnableAjax = false
          } 
        } 
                var currentTextBox = null
                var currentDatePicker = null
     
                //This method is called to handle the onclick and onfocus client side events for the texbox 
                function showPopup(sender, e) 
                { 
                    //this is a reference to the texbox which raised the event 
                    currentTextBoxsender
                     
                    //this gets a reference to the datepicker, which will be shown, to facilitate 
                    //the selection of a date 
                    var datePicker = $find("<%= RadDatePicker1.ClientID %>"); 
                     
                    //this variable is used to store a reference to the date picker, which is currently 
                    //active 
                    currentDatePicker = datePicker
                     
                    //this method first parses the date, that the user entered or selected, and then 
                    //sets it as a selected date to the picker 
                    datePicker.set_selectedDate(currentDatePicker.get_dateInput().parseDate(sender.value)); 
                     
                    //the code lines below show the calendar, which is used to select a date. The showPopup 
                    //function takes three arguments - the x and y coordinates where to show the calendar, as 
                    //well as its height, derived from the offsetHeight property of the textbox 
                    var position = datePicker.getElementPosition(sender); 
                    datePicker.showPopup(position.x, position.y + sender.offsetHeight); 
                } 
                 
                //this handler is used to set the text of the TextBox to the value of selected from the popup 
                function dateSelected(sender, args) 
                { 
                    if(currentTextBox != null) 
                    { 
                    //currentTextBox is the currently selected TextBox. Its value is set to the newly selected 
                    //value of the picker 
                    currentTextBox.value = args.get_newValue(); 
                    } 
                } 
                 
                //this function is used to parse the date entered or selected by the user 
                function parseDate(sender, e) 
                { 
                    if(currentDatePicker != null) 
                    { 
                       var date = currentDatePicker.get_dateInput().parseDate(sender.value); 
                       var dateInput = currentDatePicker.get_dateInput(); 
                        
                       if(date == null) 
                       { 
                            date = currentDatePicker.get_selectedDate(); 
                       } 
                        
                       var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat()); 
                       sender.value = formattedDate
                    } 
                } 
        </script> 
    </telerik:RadCodeBlock> 
    <div> 
    <asp:Label runat="server" ID="statusLbl"></asp:Label><br /> 
    <asp:TextBox ID="TextBox1" runat="server" onclick="showPopup(this, event);" onfocus="showPopup(this, event);" onblur="parseDate(this, event)"></asp:TextBox> 
    <asp:TextBox ID="TextBox2" runat="server" onclick="showPopup(this, event);" onfocus="showPopup(this, event);" onblur="parseDate(this, event)"></asp:TextBox> 
    <asp:TextBox ID="TextBox3" runat="server" onclick="showPopup(this, event);" onfocus="showPopup(this, event);" onblur="parseDate(this, event)"></asp:TextBox> 
    <telerik:RadDatePicker ID="RadDatePicker1" Style="display: none;" MinDate="01/01/1990" AutoPostBack="true" 
        MaxDate="12/31/2100" runat="server"
        <ClientEvents OnDateSelected="dateSelected" /> 
    </telerik:RadDatePicker> 
     
    </div> 
    </form> 
    </body> 
    </html> 

     
    Partial Class import_datepicker 
        Inherits System.Web.UI.Page 
     
        Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
            statusLbl.Text = "Postback at" & DateTime.Now.ToString 
        End Sub 
    End Class 
     


  • Posted on Aug 14, 2009 (permalink)

    Found a little workaround:
    - set autopostback=false on RadDatePicker.
    - set autopostback to true on the textbox.
    - modify js:
    old line: (function dateSelected)
    currentTextBox.value = args.get_newValue();  
    new line:
    if (currentTextBox.value != args.get_newValue()) {currentTextBox.value = args.get_newValue();__doPostBack(currentTextBox.id, "");} else {return false;} 
     

    Hope this helps, John, or anyone..

  • Andy avatar

    Posted on Jan 15, 2010 (permalink)

    I too have had a similar problem. Setting the properties and when saving the standard form asks for the attached screen shot.

    1. On BindData() we select the date like this: 
    rdpDate.SelectedDate = dateTime; //whatever the date is in the database.

     

    if (!Page.IsPostBack)  
    {  
           BindData();
          //RadDate  
          rdpDate.MinDate = DateTime.MinValue;  
          rdpDate.MaxDate = DateTime.Now.AddYears(-12);  
     
          rdpDaterdpDate.Calendar.RangeMinDate = rdpDate.MinDate;  
          rdpDaterdpDate.Calendar.RangeMaxDate = rdpDate.MaxDate;  
    OR
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">  
                            <telerik:RadDatePicker ID="rdpDate" runat="server" MinDate="1900-01-01" MaxDate="1998-01-01" AutoPostBack="true" Culture="en-GB">  
                                <Calendar ID="Calendar1" runat="server">  
                                </Calendar> 
                            </telerik:RadDatePicker> 
    </telerik:RadAjaxPanel> 

    has the same results of asking to download the form! Also the RadCalender will pop up (today is 15/1/2010) and so the days will be displayed as allowed to be selected but when selecting them a validation error occurs. It will allow me to select 01/01/1998). This is clearly a bug and can easily be replicated.

    Removing the above and the problem goes away except for now the user can select the dates that we dont wish the user to select.
    There are definitely other bugs with this control from our testing and I think that you should take a closer look at it.

    2. Also as a side note as you will need to do some work on this control before we can use it [Today] [OK] [Close] buttons should be a slightly different order such as [Close] [Today] [OK] - putting the [OK] button in the middle is not the easiest place
    for the user to select the date which 9/10 out of ten is what they are trying to do.

    Cheers,
    Andy

  • Yavor Yavor admin's avatar

    Posted on Jan 21, 2010 (permalink)

    Hi Andy,

    If you have a similar issue, the best option would be to open a formal support ticket, and send us a small working project, demonstrating your setup, and showing the unwanted behavior. We will debug it locally, and get back to you with more information on the matter.

    Best wishes,
    Yavor
    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.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Calendar > RadDatePicker Autopostback bug?