public class DatePicker : Telerik.Web.UI.RadDatePicker |
{ |
protected override void OnLoad(EventArgs e) |
{ |
//set default properties |
Skin = "WebBlue"; |
Calendar.Skin = "WebBlue"; |
DateInput.Skin = "WebBlue"; |
DateInput.BackColor = System.Drawing.Color.White; |
DateInput.Font.Bold = true; |
Calendar.ShowRowHeaders = false; |
Width = Unit.Pixel(120); |
base.OnLoad(e); |
} |
} |
BUT.... When I try to access the client-side API I am not able to access any of the built-in methods or properties. For example, I have a page with a dropdown on it. When the dropdown's selection is chnaged, I am trying to clear the contents of my DatePicker control using javascript. Here is the code of a user control that encpsulates my server controls and the javascript:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucAssessmentTimePeriodSelection.ascx.cs" Inherits="BYOA.Admin.UserControls.ucAssessmentTimePeriodSelection" %> |
<%@ Register Assembly="SSG.WebControls" Namespace="SSG.WebControls.ServerControls" TagPrefix="cc2" %> |
<%@ Register Assembly="BYOA.Admin" Namespace="BYOA.Admin.ServerControls" TagPrefix="cc1" %> |
<script type="text/javascript"> |
function ClearDate() |
{ |
var datePicker = document.getElementById('<%= dtStartDate.ClientID %>'); alert(datePicker.name); |
datePicker.clear(); |
} |
function ClearTestingPeriod(sender, eventArgs) |
{ |
var ddlTestingPeriod = document.getElementById('<%= ddlTestingPeriod.ClientID %>'); |
ddlTestingPeriod.selectedIndex = 0; |
} |
</script> |
<cc1:TestingPeriodDropDownList runat="server" ID="ddlTestingPeriod" onChange="ClearDate();"></cc1:TestingPeriodDropDownList><br><br> |
<cc2:DatePicker runat="server" ID="dtStartDate"> |
<ClientEvents OnDateSelected="ClearTestingPeriod" /> |
</cc2:DatePicker> |
The error I am getting when the dropdown is changed is on the line "datePicker.clear();" which is:
"Object doesn't support this property or method."
I am able to do an alert(datePicker.name) and it works just fine, so I know that I at least am getting a reference to the object. It appears that it does not understand the type of the object and that it is a RadDatePicker, and therefore doees not know what "obj.clear()" is. Any help would be MOST appreciated!