I have a date picker for which the calendar icon is not shown but it pops up when you click in the textbox. This is achieved using javascript like so
function ToggleStartDateCalendarPopup()
{
$find(
"<%= dpStartDate.ClientID %>").showPopup();
}
<telerik:RadDatePicker ID="dpStartDate"
runat="server">
<DatePopupButton Visible="False"></DatePopupButton>
<DateInput onclick="ToggleStartDateCalendarPopup()">
</DateInput>
</telerik:RadDatePicker>
This works fine but I wanted to put the javascript into an include file. However the code stops working when I do this and I get this error
Message: 'null' is null or not an object
I also tried adding the javascript using registerclientscriptblock but got the same error message
Dim s As New StringBuilder
s.AppendLine(
"<script>")
s.AppendLine(
"function ToggleStartDateCalendarPopup(){")
s.AppendLine(
"$find(""<%= dpStartDate.ClientID %>"").showPopup();}")
s.AppendLine(
"function ToggleEndDateCalendarPopup(){")
s.AppendLine(
"$find(""<%= dpEndDate.ClientID %>"").showPopup();}")
s.AppendLine(
"</script>")
If Not Page.IsPostBack Then
'Page.ClientScript.RegisterClientScriptInclude("DatePopups", ResolveClientUrl("~/JavaScript/DatePopups.js"))
Page.ClientScript.RegisterStartupScript(
Me.GetType(), "DatePopup", s.ToString)
The error is presumably because of the data binding expressions. How can i fix this so I can have my javascript in an include file that can be shared among pages?
thansk