Trying to get a reference to the Calendar

2 posts, 0 answers
  1. bo
    bo avatar
    26 posts
    Member since:
    Jan 2009

    Posted 13 Aug 2010 Link to this post

    simple little page here, but every time I select I get the javascript error $f is not defined.  All I'm trying to do is set the selected date of the calendar.
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="crud.aspx.cs" Inherits="Grid_crud" %>
     
    <%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body>
     
        <script language="javascript" type="text/javascript">
            function dummy() {
                var calendar = $find("<%= gridCalendar.ClientID %>");
                calendar.selectDate("05/10/2010", true);
            }
        </script>
     
        <form id="form1" runat="server">
        <div>
            <radCln:RadCalendar ID="gridCalendar" runat="server">
            </radCln:RadCalendar>
            <button type="button" id="Select" style="margin-top: 10px; margin-right: 2px;" onclick="dummy();">
                Select</button>
        </div>
        </form>
    </body>
    </html>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Aug 2010 Link to this post

    Hello,


    From your code I can see that, you are using RadControls for ASP.NET version, not the Ajax version and you are referring the Ajax version documentation.

    You need to use the following code to get client side object.
        var calendar = <%= RadCalendar1.ClientID %>;


    And the relevant links are here:
    Client-Side API
    Client-Side API (Documentation)


    -Shinu.
Back to Top