Answered by:
ASP.NET-->Ajax-->Getting error Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.

Question
-
I have History button in main screen, when you click it opens pop-up screen which has dropdown, when you select some value from DD it displays result.
Now the problem is when i select something from dropdown, displays the result. Then i click close button, go back to original screen. But then when i click History button again displays the below error message:
Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler
I am getting an error only after selecting value from DD. Otherwise it works fine.
Failing on following statement:
var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {if ((typeof(element._events) !== 'object') || (element._events == null)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);I have following coded in ASP.NET page. <ajaxToolkit:ModalPopupExtender ID="modalPopupAddMargin" runat="server" TargetControlID="buttonAddMarginDummy"PopupControlID="panelAddMargin" PopupDragHandleControlID="panelAddMargin" BackgroundCssClass="modalBackground" DropShadow="false" /> <ajaxToolkit:ModalPopupExtender ID="modalPopupHistory" runat="server" TargetControlID="buttonDummyForHistory"PopupControlID="panelHistoryMarginSchedule" PopupDragHandleControlID="panelHistoryMarginSchedule"BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID = "buttonHistoryClose" /> Panel code: <!--Popup div Section Start For History Margin --> <asp:Panel ID="panelHistoryMarginSchedule" class="popup" Style="display: none" runat="server"> <asp:UpdatePanel ID="updatePanelHistoryMargin" runat="server" UpdateMode ="Conditional" ChildrenAsTriggers="true" ><ContentTemplate><table id="Table2" width="45%" border="0" cellspacing="0" cellpadding="2" runat="server"> <tr><td class="popupTitle"><div><asp:Label ID="labelHistoryMarginClearPar" runat="server"></asp:Label></div></td></tr> <tr><td><fieldset><legend><asp:Label ID="labelHistoryMargin" runat="server" Text="Margin Schedule"></asp:Label></legend> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="formTable"> <tr> <td style="width: 30%;"> <asp:Label ID="labelViewRateType" runat="server"></asp:Label> </td> <td style="width: 70%;"> <Acbs:EnumDropDownList ID="dropDownListViewRateType" runat="server" CssClass="selectBox" AutoPostBack="true" OnSelectedIndexChanged="DropDownListViewRateType_SelectedIndexChanged" EnumTypeName="Acbs.Entities.InterestRateIndexList" AlphabeticalSort="true" /> <ajaxToolkit:ListSearchExtender runat="server" TargetControlID="dropDownListViewRateType" PromptCssClass="listSearchPrompt" ID="listSearchViewRateType" /> </td> </tr> <tr><td style="border-color: Black; border-width: thin;" colspan="2"><table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td><Acbs:StyledGridView ID="gridViewHistoryMarginSchedule" Class="gridTable" runat="server" AutoGenerateColumns="False" GridLines="Vertical" OnRowDataBound="GridViewHistoryMarginSchedule_RowDataBound" DataKeyNames="FacilityMarginScheduleIdentifier" OnInit="GridViewHistoryMarginSchedule_Init" OnPageIndexChanging="GridViewHistoryMarginSchedule_PageIndexChanging" AllowPaging="true" PageSize="5"> <RowStyle CssClass="gridArea" /> <PagerSettings Mode="NumericFirstLast"></PagerSettings> <AlternatingRowStyle CssClass="gridArea alter" /> <Columns> <asp:TemplateField HeaderText="Rate Type"> <ItemTemplate></ItemTemplate></asp:TemplateField><asp:BoundField /><asp:BoundField /><asp:BoundField /> </Columns> </Acbs:StyledGridView></td></tr></table></td></tr></table></fieldset></td></tr></table></ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="dropDownListViewRateType" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel><table><tr><td class="actionButtonRow"><Acbs:CustomButton ID="buttonHistoryClose" runat="server" CausesValidation="false" OnClick="ButtonHistoryClose_Click" /></td></tr></table></asp:Panel> In code Behind: When change the value in dropdown:
protected
void DropDownListViewRateType_SelectedIndexChanged(object sender, EventArgs e)
TList<FacilityMarginSchedule> margincollection = (TList<FacilityMarginSchedule>)ViewState[MarginScheduleList];
if (margincollection != null && margincollection.Count > 0)
if (dropDownListViewRateType.SelectedItem.Text != All)
int interestTypeCode = (int.TryParse(dropDownListViewRateType.SelectedValue, out interestTypeCode) ? interestTypeCode : 0);
else
{
gridViewHistoryMarginSchedule.DataSource = GetSortedMarginScheduleList();
gridViewHistoryMarginSchedule.DataBind();
// this.modalPopupHistory.Show();
this.updatePanelHistoryMargin.Update();
}
}
}
gridViewHistoryMarginSchedule.DataSource = GetSortedMarginScheduleListByType(interestTypeCode);
gridViewHistoryMarginSchedule.DataBind();
}
{
{
{
ViewState[MarginScheduleHistoryIndex] = 0;
- Moved by nobugz Thursday, September 17, 2009 2:30 AM forums.asp.net (From:.NET Base Class Library)
Wednesday, September 16, 2009 12:48 PM
Answers
-
Hi,
Thank you for your post! I would suggest posting your question in one of the MS Forum,
located here: http://forums.asp.net/1008.aspx
Have a great day!
Shrikant Maske Tier 2 Application Support Server and Tools Online Operations Team- Proposed as answer by Shrikant Maske Thursday, September 17, 2009 4:27 AM
- Marked as answer by Shrikant Maske Wednesday, January 27, 2010 10:18 AM
Thursday, September 17, 2009 4:27 AM