Naresh Babu Gopavaram

Naresh Babu Gopavaram

  • 1.5k
  • 248
  • 248.8k

Please give solution for Microsoft JScript runtime error: Sys.InvalidOperationException:

Feb 6 2012 1:32 AM

Hi 
Experts
I am facing the following issue

Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method. 

I am having a Grid that is filled with Locations.To add locations i am using ajaxmodalpopup.when i click on add location imagebutton in gridview footer the popup is working fine.but when i press F5 while popup is opened i am getting the issue.
here is the sample code

<asp:GridView ID="gdvLocations" runat="server" AutoGenerateColumns="False" DataKeyNames="SerialNumber"
CellPadding="4" GridLines="None" ShowFooter="True" OnRowCancelingEdit="gdvLocations_RowCancelingEdit"
OnRowEditing="gdvLocations_RowEditing" OnRowDeleting="gdvLocations_RowDeleting"
OnRowUpdating="gdvLocations_RowUpdating" OnRowDataBound="gdvLocations_RowDataBound"
OnPreRender="gdvLocations_PreRender" Width="98%" EnableModelValidation="false">
<AlternatingRowStyle CssClass="alt" />
<Columns>
<asp:TemplateField InsertVisible="False" meta:resourcekey="TemplateFieldResource5"
SortExpression="BusinessEntityID" Visible="False">
<ItemTemplate>
<asp:Label ID="lblBusinessEntityID" runat="server" meta:resourcekey="lblBusinessEntityIDResource1"
Text='<%# Eval("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SI.No" InsertVisible="False" meta:resourcekey="TemplateFieldResource6"
SortExpression="LocationId">
<ItemTemplate>
<asp:Label ID="lblLocationID" runat="server" meta:resourcekey="lblLocationIDResource1"
Text='<%# Eval("SerialNumber") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Location Name" meta:resourcekey="TemplateFieldResource7"
SortExpression="LocationName">
<EditItemTemplate>
<asp:TextBox ID="txtLocationName" runat="server" meta:resourcekey="txtLocationNameResource1"
Text='<%# Eval("ChildEntityName") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvLocationNameEdit" runat="server" ControlToValidate="txtLocationName"
ErrorMessage="*" ValidationGroup="EditRow"></asp:RequiredFieldValidator>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtfooterLocationName" ValidationGroup="addAddress" runat="server"
meta:resourcekey="txtfooterLocationNameResource1"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvLocationName" runat="server" ControlToValidate="txtfooterLocationName"
meta:resourcekey="rfvLocationName" ValidationGroup="SecondRow"></asp:RequiredFieldValidator>
</FooterTemplate>
<ItemTemplate>
<div style="width: 100px; word-break: break-all; left: 0">
<asp:Label ID="lblLocationName" runat="server" meta:resourcekey="lblLocationNameResource1"
Text='<%# Eval("ChildEntityName") %>' Width="120"></asp:Label>
</div>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Address" ItemStyle-CssClass="nooverflow" ItemStyle-Wrap="true"
meta:resourcekey="TemplateFieldResource8" SortExpression="Address">
<EditItemTemplate>
<asp:TextBox ID="txtAddress" runat="server" meta:resourcekey="txtAddressResource1"
ReadOnly="True" Text='<%# Eval("AddressDetails") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvAddressEdit" runat="server" ControlToValidate="txtAddress"
meta:resourcekey="rfvAddressEdit" ValidationGroup="EditRow"></asp:RequiredFieldValidator>
<asp:ImageButton ID="ibtnEditAddress" runat="server" CausesValidation="False" CommandArgument='<%# Eval("SerialNumber") %>'
CommandName="EditAddress" ToolTip="Add Address" ImageUrl="~/Assets/Images/add.png"
meta:resourcekey="ibtnEditAddressResource1" OnClick="EditAddress_Click" Style="background: none;" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtfooterAddress" runat="server" meta:resourcekey="txtfooterAddressResource1"
ReadOnly="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvAddress" runat="server" ControlToValidate="txtfooterAddress"
meta:resourcekey="rfvAddress" ValidationGroup="SecondRow"></asp:RequiredFieldValidator>
<asp:ImageButton ID="ibtnAddAddress" runat="server" CausesValidation="False" CommandName="AddAddressFooter"
ImageUrl="~/Assets/Images/add.png" meta:resourcekey="ibtnAddAddress" OnClick="ibtnAddAddressNoData_Click"
Style="background: none;" />
</FooterTemplate>
<ItemTemplate>
<div style="width: 500px; word-break: break-all;">
<asp:Label ID="lblAddress" runat="server" meta:resourcekey="lblAddressResource1"
Text='<%# Eval("AddressDetails") %>'></asp:Label>
</div>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:CommandField ButtonType="Link" EditText="Edit" UpdateText="Update" CancelText="Cancel"
DeleteText="Delete" CausesValidation="true" ValidationGroup="EditRow" HeaderText="Actions"
ShowEditButton="True" ShowDeleteButton="True"></asp:CommandField>
<asp:TemplateField meta:resourcekey="TemplateFieldResource9">
<EditItemTemplate>
</EditItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="lnkInsert" runat="server" CausesValidation="true" meta:resourcekey="lnkInsertResource2"
OnClick="lnkInsertLocation_Click" ValidationGroup="SecondRow">
<asp:Image runat="server" ImageUrl="~/Assets/Images/accept.png" ID="imgInsert" meta:resourcekey="imgInsert">
</asp:Image>
</asp:LinkButton>
</FooterTemplate>
<ItemTemplate>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
<EditRowStyle CssClass="alt" />
<EmptyDataRowStyle BackColor="#FFFFFF" BorderStyle="None" Font-Bold="True" ForeColor="#333333" />
<EmptyDataTemplate>
<table style="width: 100%;">
<tr>
<th align="left">
Location Name
</th>
<th align="left">
Address
</th>
<th align="left">
Actions
</th>
</tr>
<tr style="border-style: none; color: White; font-weight: bold; margin: 0;">
<td>
<asp:TextBox ID="txtNoDataLocation" runat="server" CssClass="email"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvLocation" runat="server" ControlToValidate="txtNoDataLocation"
meta:resourcekey="rfvLocation" ValidationGroup="firstrow"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtNoDataAddress" runat="server" CssClass="email" ReadOnly="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvAddress" runat="server" ControlToValidate="txtNoDataAddress"
meta:resourcekey="rfvAddress" ValidationGroup="firstrow"></asp:RequiredFieldValidator>
<asp:ImageButton ID="ibtnAddAddressNoData" runat="server" CausesValidation="False"
ImageUrl="~/Assets/Images/add.png" meta:resourcekey="ibtnAddAddressNoData" OnClick="ibtnAddAddressNoData_Click"
Style="background: none;" />
</td>
<td align="center">
<asp:LinkButton ID="NoDataInsert" runat="server" CausesValidation="true" meta:resourcekey="NoDataInsertResource1"
OnClick="NoDataInsert_Click" ValidationGroup="firstrow">
<asp:Image runat="server" ImageUrl="~/Assets/Images/accept.png" ID="imgCreate" meta:resourcekey="imgCreate">
</asp:Image>
</asp:LinkButton>
</td>
</tr>
</table>
</EmptyDataTemplate>
<FooterStyle BackColor="White" Font-Bold="True" ForeColor="White" />
<HeaderStyle Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#FFFFFF" />
<SelectedRowStyle CssClass="alt" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
<asp:Panel ID="pnlAddressDetails" runat="server" meta:resourcekey="pnlAddressDetailsResource1"
Style="display: none;">
<asp:UpdatePanel ID="upnlAddress" runat="server">
<ContentTemplate>
<div class="newQoute-status" style="width: 920px; height: 500px; border: 1px solid #808080;
background-color: #FFFFFF;">
<div class="taskHeader">
<p>
<asp:Label ID="lblAddressDetails" Font-Bold="true" runat="server" meta:resourcekey="lblAddressDetails" />
</p>
<asp:Label ID="lblStatusMessage" runat="server" ForeColor="Red"></asp:Label>
</div>
<div style="padding-left: 10px;">
<div class="inputDetails" style="width: 100%;">
<fieldset>
<asp:Label ID="lblStreetNumberForLocation" runat="server" meta:resourcekey="lblStreetNumber"
CssClass="inputLabel"></asp:Label><br />
<asp:TextBox ID="txtStreetNumberForLocation" runat="server" CssClass="email" MaxLength="50"></asp:TextBox>
<span id="spanStreetNumberForLocation" runat="server" style="color: Red; font-weight: bold;
font-size: 18px;">*</span>
<asp:RequiredFieldValidator ID="rfvStreetNumberForLocation" runat="server" ControlToValidate="txtStreetNumberForLocation"
ValidationGroup="AddAddressDetails" Display="Dynamic" meta:resourcekey="rfvStreetNumberForLocation"
ForeColor="Red">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regStreetNumberForLocation" runat="server" ControlToValidate="txtStreetNumberForLocation"
meta:resourcekey="regStreetNumberForLocation" ValidationExpression="^[-;:,0-9a-zA-Z./ ]+$"
Display="Dynamic" SetFocusOnError="true">
</asp:RegularExpressionValidator>
</fieldset>
<fieldset>
<asp:Label ID="lblStreetNameForLocation" runat="server" meta:resourcekey="lblStreetName"
CssClass="inputLabel"></asp:Label><br />
<asp:TextBox ID="txtStreetNameForLocation" runat="server" CssClass="email" MaxLength="50"></asp:TextBox>
<span id="spanStreetNameForLocation" runat="server" style="color: Red; font-weight: bold;
font-size: 18px;">*</span>
<asp:RequiredFieldValidator ID="rfvStreetNameForLocation" runat="server" ControlToValidate="txtStreetNameForLocation"
ValidationGroup="AddAddressDetails" Display="Dynamic" meta:resourcekey="rfvStreetNameForLocation"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regStreetNameForLocation" runat="server" ControlToValidate="txtStreetNameForLocation"
meta:resourcekey="regStreetNameForLocation" ValidationExpression="^[-;:,0-9a-zA-Z./ ]+$"
Display="Dynamic" SetFocusOnError="true"></asp:RegularExpressionValidator>
</fieldset>
<fieldset>
<asp:Label ID="lblSuiteAppartmentForLocation" runat="server" meta:resourcekey="lblSuiteAppartment"
CssClass="inputLabel"></asp:Label>
<asp:TextBox ID="txtSuiteAppartmentForLocation" runat="server" MaxLength="50" CssClass="email"></asp:TextBox>
<asp:RegularExpressionValidator ID="regSuiteAppartmentForLocation" runat="server"
ControlToValidate="txtSuiteAppartmentForLocation" meta:resourcekey="regSuiteAppartmentForLocation"
ValidationExpression="^[0-9a-zA-Z ]+$" Display="Dynamic" SetFocusOnError="true"></asp:RegularExpressionValidator>
</fieldset>
</div>
<div class="inputDetails">
<fieldset>
<asp:Label ID="lblCityForLocation" runat="server" meta:resourcekey="lblCity" CssClass="inputLabel"></asp:Label><br />
<asp:TextBox ID="txtCityForLocation" runat="server" CssClass="email" MaxLength="50"></asp:TextBox><span
id="spanCityForLocation" runat="server" style="color: Red; font-weight: bold;
font-size: 18px;">*</span>
<asp:RequiredFieldValidator ID="rfvCityForLocation" runat="server" ControlToValidate="txtCityForLocation"
ValidationGroup="AddAddressDetails" Display="Dynamic" meta:resourcekey="rfvCityForLocation"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regCityForLocation" runat="server" ControlToValidate="txtCityForLocation"
ValidationExpression="^[a-zA-Z ]+$" Display="Dynamic" SetFocusOnError="true"
meta:resourcekey="regCityForLocation"></asp:RegularExpressionValidator>
</fieldset>
<fieldset>
<asp:Label ID="lblStateForLocation" runat="server" meta:resourcekey="lblStateForLocation"
CssClass="inputLabel"></asp:Label>
<asp:DropDownList ID="ddlStateForLocation" runat="server" Width="200">
</asp:DropDownList>
<span id="spanStateForLocation" runat="server" style="color: Red; font-weight: bold;
font-size: 18px;">*</span>
<asp:RequiredFieldValidator ID="rfvStateForLocation" runat="server" InitialValue="Select"
ControlToValidate="ddlStateForLocation" ValidationGroup="AddAddressDetails" Display="Dynamic"
meta:resourcekey="rfvStateForLocation" ForeColor="Red" SetFocusOnError="true"></asp:RequiredFieldValidator>
</fieldset>
<fieldset>
<asp:Label ID="lblZipForLocation" runat="server" meta:resourcekey="lblZip" CssClass="inputLabel"></asp:Label>
<asp:DropDownList ID="ddlZipForLocation" runat="server" Width="200">
<asp:ListItem Text="Select" Value="Select"></asp:ListItem>
<asp:ListItem Text="95811" Value="95811"></asp:ListItem>
<asp:ListItem Text="95814" Value="95814"></asp:ListItem>
<asp:ListItem Text="95815 " Value="95815"></asp:ListItem>
<asp:ListItem Text="95816" Value="95816"></asp:ListItem>
<asp:ListItem Text="95817" Value="95817"></asp:ListItem>
<asp:ListItem Text="95818" Value="95818"></asp:ListItem>
<asp:ListItem Text="95819" Value="95819"></asp:ListItem>
<asp:ListItem Text="95820" Value="95820"></asp:ListItem>
<asp:ListItem Text="95821" Value="95821"></asp:ListItem>
<asp:ListItem Text="95822" Value="95822"></asp:ListItem>
<asp:ListItem Text="95823" Value="95823"></asp:ListItem>
<asp:ListItem Text="95824" Value="95824"></asp:ListItem>
<asp:ListItem Text="95825" Value="95825"></asp:ListItem>
<asp:ListItem Text="95826" Value="95826"></asp:ListItem>
<asp:ListItem Text="95827" Value="95827"></asp:ListItem>
<asp:ListItem Text="95828" Value="95828"></asp:ListItem>
<asp:ListItem Text="95829" Value="95829"></asp:ListItem>
<asp:ListItem Text="95830" Value="95830"></asp:ListItem>
<asp:ListItem Text="95831" Value="95831"></asp:ListItem>
<asp:ListItem Text="95832" Value="95832"></asp:ListItem>
<asp:ListItem Text="95833" Value="95833"></asp:ListItem>
<asp:ListItem Text="95834" Value="95834"></asp:ListItem>
<asp:ListItem Text="95835" Value="95835"></asp:ListItem>
<asp:ListItem Text="95836" Value="95836"></asp:ListItem>
<asp:ListItem Text="95837" Value="95837"></asp:ListItem>
<asp:ListItem Text="95838" Value="95838"></asp:ListItem>
<asp:ListItem Text="95841" Value="95841"></asp:ListItem>
<asp:ListItem Text="95842" Value="95842"></asp:ListItem>
<asp:ListItem Text="95843" Value="95843"></asp:ListItem>
<asp:ListItem Text="95864" Value="95864"></asp:ListItem>
<asp:ListItem Text="95865" Value="95865"></asp:ListItem>
</asp:DropDownList>
<span id="spanZipForLocation" runat="server" style="color: Red; font-size: 18px;
font-weight: bold;">*</span>
<br />
<asp:RequiredFieldValidator ID="rfvZipForLocation" runat="server" ControlToValidate="ddlZipForLocation"
ValidationGroup="AddAddressDetails" Display="Dynamic" ForeColor="Red" meta:resourcekey="rfvZipForLocation"
InitialValue="Select"></asp:RequiredFieldValidator>
</fieldset>
</div>
<div style="width: 880px; float: left; text-align: center; margin: 20px 0 0 0; padding-top: 10px;
border-top: 1px solid #c7d5de;">
<asp:Button ID="btnGetMatchingAddress" runat="server" CssClass="btnBand-Grn" ValidationGroup="AddAddressDetails"
Text="Search" OnClick="btnGetMatchingAddress_Click" />
<asp:Button Text="Cancel" ID="btnAddMoreDetailsCancel" runat="server" CssClass="btnBand-Red"
CausesValidation="false" meta:resourcekey="btnCancelResource1" OnClick="btnAddMoreDetailsCancel_Click" />
</div>
</div>
<div style="float: left; padding: 20px 0; margin-left: 30px; width: 840px; overflow: auto;
height: 150px;">
<asp:GridView ID="gdvEpassmatchedAddress" runat="server" AutoGenerateColumns="false"
BorderColor="#c7d5de" BorderWidth="1" CssClass="policyInfo" Width="830px" AllowPaging="True"
OnPageIndexChanging="gdvEpassmatchedAddress_PageIndexChanging" EnableViewState="true"
PageSize="5" EmptyDataText="No Records Found">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:RadioButton ID="rdbtnMatching" runat="server" CausesValidation="false" AutoPostBack="true"
EnableViewState="true" GroupName="checkAddress" onclick="RadioCheckForMatching(this);"
OnCheckedChanged="rdbtnMatching_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sl.No">
<ItemTemplate>
<asp:Label ID="lblSlNumber" runat="server" Text='<%#Container.DataItemIndex+1 %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Street Number" DataField="p_Number" ControlStyle-CssClass="textWrap"
ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
<ControlStyle CssClass="textWrap" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField HeaderText="Street Name" DataField="p_Street" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="City" DataField="p_City" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="State" DataField="p_State" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="Suite" DataField="p_Suite" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="Zip" DataField="p_Zip" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="POBox" DataField="p_POBox" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="IsRange" DataField="p_IsRange" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="CareOf" DataField="p_CareOf" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
<asp:BoundField HeaderText="Verified" DataField="p_Verified" ControlStyle-CssClass="textWrap">
<ControlStyle CssClass="textWrap" />
</asp:BoundField>
</Columns>
<SelectedRowStyle BackColor="#0066FF" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
</asp:GridView>
</div>
<div style="width: 100%; float: left; text-align: center; margin-top: 10px;">
<asp:Button ID="btnValidAndAssign" runat="server" Visible="false" Text="Validate and Assign"
CssClass="btnBand-Grn" CausesValidation="false" OnClick="btnValidAndAssign_Click" />
<br />
<asp:Label ID="lblValidAddressMsg" runat="server" Visible="false"></asp:Label>
<asp:HiddenField ID="hdvStreetNumber" runat="server" />
<asp:HiddenField ID="hdvStreetName" runat="server" />
<asp:HiddenField ID="hdvCity" runat="server" />
<asp:HiddenField ID="hdvState" runat="server" />
<asp:HiddenField ID="hdvSuite" runat="server" />
<asp:HiddenField ID="hdvZipCode" runat="server" />
<asp:HiddenField ID="hdvPobox" runat="server" />
<asp:HiddenField ID="hdvIsRnge" runat="server" />
<asp:HiddenField ID="hdvVerified" runat="server" />
<asp:HiddenField ID="hdvCareOf" runat="server" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

<asp:Button ID="btnmoreDetails" runat="server" meta:resourcekey="btnmoreDetailsResource1"
Style="display: none;" />
<ajaxtoolkit:ModalPopupExtender ID="mpnlAddMoreDetails" runat="server" BackgroundCssClass="modalBackground"
TargetControlID="btnmoreDetails" PopupControlID="pnlAddressDetails" CancelControlID="btnCancel"
Enabled="True" DynamicServicePath="">
</ajaxtoolkit:ModalPopupExtender>

help me plz