RadDatepicker focus

4 posts, 0 answers
  1. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 04 Dec 2009 Link to this post

    Hi,
    i am using Q2 2009 version.I am having a problem with RadDatePicker control.I want to set  focus to the raddatepicker when the page gets loaded. i am using myraddatepicker.dateinput.focus() on my page_load function,But the focus is not setting to raddatepicker.

    Please give me the solution ASAP.

    Regards
    Rahul Khinvasara.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Dec 2009 Link to this post

    Hello Rahul Khinvasara,

    I tried the following code in order to focus the DateInput, and it is working fine for me.
          RadDatePicker5.DateInput.Focus();

    Also give a try with client side approach for focusing the DateInput.
    JavaScript:
     
    <script type="text/javascript"
        function pageLoad() { 
           var DatePicker5 = $find("<%= RadDatePicker5.ClientID %>"); 
           DatePicker4.get_dateInput().focus();         
        } 
    </script> 

    I am not quite sure about what is happening at your end. Please make sure that you have not set focus to any other control in the page.

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Big
    Big avatar
    3 posts
    Member since:
    Sep 2011

    Posted 16 Sep 2011 Link to this post

    I'm having problems too setting up the focus method. Here is the entire code I tried. As you can see, I simplified the code to the bare minimum. The control loads fine if I comment out the javascript below, but when I try to set the focus to it, it gives me this error message: "Microsoft JScript runtime error: Object doesn't support this property or method" and it highlights this line as the source of the error:

    DatePicker4.get_dateInput().focus()

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Test"%>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
                <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
                </telerik:RadDatePicker>
               
                <script type="text/javascript">
                    alert('1');
                    var DatePicker4 = document.getElementById('<%= RadDatePicker1.ClientID %>');

                    alert('2');
                    DatePicker4.get_dateInput().focus();

                    alert('3');
                </script>       
            </div>
        </form>
    </body>
    </html>

     

  5. Big
    Big avatar
    3 posts
    Member since:
    Sep 2011
Back to Top