Whenever I run my site, the following error appears:
Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method
The following is my code. Note that if I remove the block of code for the collapsible panel:
<ajaxToolkit:collapsiblepanelextender id="Collapsiblepanelextender1" runat="server"
TargetControlID="pnlBusinessHoursSettings"
Collapsed="True" ExpandControlID="pnlBusinessHoursSettingsHeader" CollapseControlID="pnlBusinessHoursSettingsHeader"
SuppressPostBack="true" TextLabelID="lblBusinessHoursSettings"
ExpandedText="Business Hours Settings [-]" CollapsedText="Business Hours Settings [+]" />
Then the error doesnt occur and the page appears to work fine.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SiteConfiguration1.aspx.vb" Inherits="SiteConfiguration1" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title>Site Configuration</title><link href="../stylesheets/Intellistar.CSS" type="text/css" rel="stylesheet"/></head><body style="margin-top:0px; margin-left:1px; margin-right:1px;" ><table id="MainTable" cellpadding="0" cellspacing="0" align="center" border="0" class="maintable"><tbody><tr><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"><form id="form1" runat="server"><asp:ScriptManager id="scriptmanager1" enablepartialrendering="true" runat="Server" /><div><table id="Table1" cellpadding="0" cellspacing="0" style="width:989px; " runat="server"><tr><td> </td></tr><tr><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"><div><asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Always"><ContentTemplate><asp:Panel ID="pnlBusinessHoursSettingsHeader" runat="server" style="height:24px;width:989px;" BackColor="#1E4A96"><asp:Label ID="lblBusinessHoursSettings" runat="server" CssClass="bglabel" Text="Business Hours Settings [+]" ForeColor="White"></asp:Label></asp:Panel></ContentTemplate></asp:UpdatePanel></div></td></tr><tr><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"><asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always"><ContentTemplate><ajaxToolkit:collapsiblepanelextender id="Collapsiblepanelextender1" runat="server"
TargetControlID="pnlBusinessHoursSettings"
Collapsed="True" ExpandControlID="pnlBusinessHoursSettingsHeader" CollapseControlID="pnlBusinessHoursSettingsHeader"
SuppressPostBack="true" TextLabelID="lblBusinessHoursSettings"
ExpandedText="Business Hours Settings [-]" CollapsedText="Business Hours Settings [+]" /><asp:Panel ID="pnlBusinessHoursSettings" runat="server" style="width:989px; " BorderColor="Transparent" BorderStyle="None" BorderWidth="1px"><table id="tblBusinessHours" cellpadding="0" cellspacing="0" style="width:100%; border-style:solid; border-color:Black; border-width:1px" runat="server" ><tr><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"></td><td colspan="2" style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"><asp:Label ID="Label1" runat="server" Font-Bold="true" Text="Holidays"></asp:Label></td></tr><tr><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"></td></tr><tr><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"></td><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"></td><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"><asp:Label ID="Label2" runat="server" Text="Show Holidays for:"></asp:Label></td><td style="margin-top: 1px; padding-left: 0px; margin-left: 0px; padding-top: 1px; margin-bottom:0px; padding-bottom:0px;"><asp:DropDownList ID="dpdYearFilter" runat="server" AutoPostBack="True" OnSelectedIndexChanged="dpdYearFilter_SelectedIndexChanged"></asp:DropDownList></td></tr></table></asp:Panel></ContentTemplate></asp:UpdatePanel></td></tr></table></div></form></td></tr></tbody></table></body></html> Option Strict OnPartial Class SiteConfiguration1
Inherits System.Web.UI.Page
#Region "Constants"
Private Const c_intEarliestYear As Integer = 1990
Private Const c_intYearsIntoFuture As Integer = 5
#End Region
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)Handles MyBase.Load
If Not Page.IsPostBack Then
PageSetup()
End If
End Sub
Private Sub PageSetup()
LoadSiteSettings()
End Sub
Private Sub LoadSiteSettings()
FillYearFilterDropdown()
LoadHolidays()
End Sub
Private Sub FillYearFilterDropdown()
Dim intYear As Integer
For intYear = Today.Year + c_intYearsIntoFuture To c_intEarliestYear Step -1
Dim itemYear As New ListItem
itemYear.Text = intYear.ToString
itemYear.Value = intYear.ToString
dpdYearFilter.Items.Add(itemYear)
Next
'Add "All"
Dim itemAll As New ListItem
itemAll.Text = "Show All"
itemAll.Value = ""
dpdYearFilter.Items.Insert(0, itemAll)
'Select the current year by default
dpdYearFilter.SelectedValue = Today.Year.ToString
End Sub
Private Sub LoadHolidays()
'Put code to load holidays here
End Sub
Protected Sub dpdYearFilter_SelectedIndexChanged(ByVal senderAs Object, ByVal e As System.EventArgs)
LoadHolidays()
End Sub
End Class
Any help or ideas would be much appreciated, thanks :)