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

RadDatepicker focus

3 Answers 294 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 04 Dec 2009, 02:02 PM
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.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Dec 2009, 06:51 AM
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.
0
Big
Top achievements
Rank 1
answered on 16 Sep 2011, 04:05 PM
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>

 

0
Big
Top achievements
Rank 1
answered on 16 Sep 2011, 05:32 PM
Tags
Calendar
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Big
Top achievements
Rank 1
Share this question
or