Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method
Am Getting this error when i am going to save the gridview data
and that girdview which is not in update panel

if i place that girdview in update panel then m getting same error on cancel button

there are 2 button on form save and cancel button

ASP.NET
<table>
                    <tr>
                        <td align="left">
                            <ajaxToolkit:TabContainer ID="TabContainer1"  runat="server" Width="900px" ActiveTabIndex="1">
                                <ajaxToolkit:TabPanel ID="TabPanel1"  runat="server" Width="100%" HeaderText="Absent Details>
                                    <HeaderTemplate>
                                        Absent Details</HeaderTemplate>
                                    <contenttemplate>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:UpdatePanel ID="UpdateAbsentDetails" runat="server">
                                                        <contenttemplate>
                                                            <asp:DataGrid ID="dtgAbsentDetails" runat="server" Width="880px" CssClass="datagrid"
                                                                AllowPaging="True" AllowSorting="True" CellPadding="4" GridLines="None" ShowFooter="True"
                                                                AutoGenerateColumns="False" OnItemDataBound="dtgAbsentDetails_ItemDataBound">
                                                                <alternatingitemstyle cssclass="AlternateItemStyle" />
                                                                <columns>
                                                                    <asp:TemplateColumn HeaderText="Pay Month">
                                                                        <itemtemplate>
                                                                            <asp:DropDownList ID="drppaymonth" runat="server" AutoPostBack="true" CssClass="PayMonthDropDownDetail"
                                                                                DataTextField="PAY_MONTH" Width="100px" OnSelectedIndexChanged="drppaymonth_SelectedIndexChanged1">
                                                                            
                                                                        </itemtemplate>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="From Date" Visible="false">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="TxtEfffrmdate" runat="server" Visible="false" MaxLength="14" Width="80px" Style="text-align: right"
                                                                                AutoPostBack="true" OnTextChanged="TxtEfffrmdate_TextChanged"> <ajaxToolkit:CalendarExtender
                                                                                    ID="txtefffrom_date_Calender"  runat="server" Enabled="True" Format="dd-MMM-yyyy"
                                                                                    PopupButtonID="ImgCal1" TargetControlID="TxtEfffrmdate">
                                                                                
                                                                            <asp:ImageButton ID="ImgCal1" runat="server" ImageUrl="~/Images/cal.gif" /></itemtemplate>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="To Date" Visible="false">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="TxtEfftodate" runat="server" Width="80px" MaxLength="15" Style="text-align: right"
                                                                                AutoPostBack="true"  Visible="false" OnTextChanged="TxtEfftodate_TextChanged"> <ajaxToolkit:CalendarExtender
                                                                                    ID="txtEfftomdate_calender"  runat="server" Enabled="True" Format="dd-MMM-yyyy"
                                                                                    PopupButtonID="ImgCal" TargetControlID="TxtEfftodate">
                                                                                
                                                                            <asp:ImageButton ID="ImgCal" runat="server" ImageUrl="~/Images/cal.gif" /></itemtemplate>
                                                                                                                
                                                                    <asp:TemplateColumn HeaderText="Actual Payable">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtactualpayble" runat="server" Width="80px">0 </itemtemplate>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Paid Days">
                                                                    <itemtemplate>
                                                                    <asp:TextBox ID="txtpaiddays" Width="80px" runat="server">0
                                                                    </itemtemplate>
                                                                    
                                                                     <asp:TemplateColumn HeaderText="Pay/Recovery Days">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtpaydays" Width="80px" runat="server">0 </itemtemplate>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Delete" Visible="false">
                                                                        <HeaderTemplate>
                                                                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                                                <contenttemplate>
                                                                                    <asp:CheckBox ID="chkAllDelete" Visible="false" runat="server" AutoPostBack="True"
                                                                                        Text="Delete" /></contenttemplate>
                                                                            
                                                                        </HeaderTemplate>
                                                                        <itemtemplate>
                                                                            <asp:CheckBox ID="chkDelete" runat="server" /></itemtemplate>
                                                                    
                                                              <asp:TemplateColumn HeaderText="ref" Visible="False">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtRefno" runat="server" Visible="false"> </itemtemplate>
                                                                    
                                                                </columns>
                                                                <edititemstyle cssclass="EditItemStyle" />
                                                                <footerstyle cssclass="gridFooter"></footerstyle>
                                                                <HeaderStyle ForeColor="White" CssClass="gridHeader"></HeaderStyle>
                                                                <itemstyle cssclass="ItemStyle"></itemstyle>
                                                                <pagerstyle mode="NumericPages" wrap="False" font-italic="False" font-strikeout="False">
                                                                    Font-Underline="False" Font-Overline="False" Font-Bold="False" Visible="False">
                                                                </pagerstyle>
                                                                <SelectedItemStyle CssClass="SelectedItemStyle"></SelectedItemStyle>
                                                            </contenttemplate>
                                                    
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                   
                                                </td>
                                            </tr>
                                        </table>
                                    </contenttemplate>
                                
                                <ajaxToolkit:TabPanel ID="Noticeperiod"  runat="server" HeaderText="Notice Pay Recovery Details"
                                    Width="100%">
                                    <contenttemplate>
                                        <table>
                                            <tr>
                                                <td>
                                                 <%--   <asp:UpdatePanel ID="updatenoticeperion" runat="server">
                                                        <contenttemplate>--%>
                                                            <asp:DataGrid ID="dtgNoticeperiod" runat="server" Width="850px" CssClass="datagrid"
                                                                AllowPaging="True" AllowSorting="True" CellPadding="4" GridLines="None" ShowFooter="True"
                                                                AutoGenerateColumns="False">
                                                                <footerstyle cssclass="gridFooter"></footerstyle>
                                                                <edititemstyle cssclass="EditItemStyle"></edititemstyle>
                                                                <SelectedItemStyle CssClass="SelectedItemStyle"></SelectedItemStyle>
                                                                <pagerstyle mode="NumericPages" wrap="False" font-italic="False" font-strikeout="False">
                                                                    Font-Underline="False" Font-Overline="False" Font-Bold="False" Visible="False">
                                                                </pagerstyle>
                                                                <alternatingitemstyle cssclass="AlternateItemStyle"></alternatingitemstyle>
                                                                <itemstyle cssclass="ItemStyle"></itemstyle>
                                                                <HeaderStyle ForeColor="White" CssClass="gridHeader"></HeaderStyle>
                                                                <columns>
                                                                    <asp:TemplateColumn HeaderText="Description">
                                                                        <itemtemplate>
                                                                            <asp:Label ID="lbldescription" runat="server" Text='<%#Bind("ALLWDED_MID") %>'> </itemtemplate>
                                                                        <HeaderStyle Width="25%"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Days">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtdays" runat="server" Text='<%#Bind("DAYS")%>'>0 </itemtemplate>
                                                                        <HeaderStyle Width="15%"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Ref coloum" Visible="false">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtRefaid" runat="server" Visible="false"> </itemtemplate>
                                                                    
                                                                </columns>
                                                            
                                                            <%--</contenttemplate>
                                                    
--%>                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="center">
                                                </td>
                                            </tr>
                                        </table>
                                    </contenttemplate>
                                
                                <ajaxToolkit:TabPanel ID="ReimbTab"  runat="server" HeaderText="Reimbursement Details">
                                    <contenttemplate>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:UpdatePanel ID="updatepnluspportDetails" runat="server">
                                                        <contenttemplate>
                                                            <asp:DataGrid ID="dtgsupportdetails" runat="server" AllowPaging="True" AllowSorting="True"
                                                                AutoGenerateColumns="False" CellPadding="4" CssClass="datagrid" GridLines="None"
                                                                meta:resourcekey="dtgppResource1" ShowFooter="True" TabIndex="5" ToolTip="Reimbursement Details"
                                                                Width="850px" PageSize="15" OnItemDataBound="dtgsupportdetails_ItemDataBound">
                                                                <footerstyle cssclass="gridFooter" />
                                                                <edititemstyle cssclass="EditItemStyle" />
                                                                <SelectedItemStyle CssClass="SelectedItemStyle" />
                                                                <pagerstyle font-bold="False" font-italic="False" font-overline="False" font-strikeout="False">
                                                                    Font-Underline="False" Mode="NumericPages" Visible="False" Wrap="False" />
                                                                <alternatingitemstyle cssclass="AlternateItemStyle" />
                                                                <itemstyle cssclass="ItemStyle" />
                                                                <HeaderStyle CssClass="gridHeader" ForeColor="White" />
                                                                <columns>
                                                                    <asp:TemplateColumn HeaderText="Reimbursement Description">
                                                                        <itemtemplate>
                                                                            <asp:UpdatePanel ID="updatedropdown" runat="server">
                                                                                <contenttemplate>
                                                                                    <asp:DropDownList ID="ddlReimbtype" runat="server" CssClass="DropDownDetail" Width="200px"
                                                                                        AutoPostBack="true" OnSelectedIndexChanged="ddlReimbtype_SelectedIndexChanged">
                                                                                    
                                                                                </contenttemplate>
                                                                            
                                                                        </itemtemplate>
                                                                        <HeaderStyle Width="25%"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn>
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtsupportamount" runat="server">0</itemtemplate>
                                                                        <HeaderStyle Width="10%"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Delete" Visible="False">
                                                                        <itemtemplate>
                                                                            <asp:CheckBox ID="chkBOXDelete" runat="server" /></itemtemplate>
                                                                        <HeaderTemplate>
                                                                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                                                <contenttemplate>
                                                                                    <asp:CheckBox ID="AllDelete" runat="server" AutoPostBack="True" Text="Delete" OnCheckedChanged="AllDelete_CheckedChanged" /></contenttemplate>
                                                                            
                                                                        </HeaderTemplate>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="kjdf" Visible="False">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtRefNo2" runat="server" Visible="false"> </itemtemplate>
                                                                    
                                                                </columns>
                                                            </pagerstyle></contenttemplate>
                                                        <triggers>
                                                            <asp:AsyncPostBackTrigger ControlID="lnkaddnewrow" EventName="Click">
                                                            <asp:AsyncPostBackTrigger ControlID="lnkdeletrow" EventName="Click">
                                                        </triggers>
                                                    
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:LinkButton ID="lnkaddnewrow" runat="server" Text="Add  New Row" OnClick="lnkaddnewrow_Click">   
                                                    <asp:LinkButton ID="lnkdeletrow" runat="server" Text="Delete Row" OnClick="lnkdeletrow_Click">
                                                </td>
                                            </tr>
                                        </table>
                                    </contenttemplate>
                                
                                <ajaxToolkit:TabPanel ID="TabAdditionalInput"  runat="server" HeaderText="Additional Details">
                                    <contenttemplate>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:UpdatePanel ID="updateadditonaldetails" runat="server">
                                                        <contenttemplate>
                                                            <asp:DataGrid ID="dtgadditionalinput" runat="server" AllowPaging="True" AllowSorting="True"
                                                                AutoGenerateColumns="False" CellPadding="4" CssClass="datagrid" GridLines="None"
                                                                meta:resourcekey="dtgppResource1" ShowFooter="True" TabIndex="5" ToolTip="Additional Details"
                                                                Width="850px" PageSize="15" OnItemDataBound="dtgadditionalinput_ItemDataBound">
                                                                <footerstyle cssclass="gridFooter" />
                                                                <edititemstyle cssclass="EditItemStyle" />
                                                                <SelectedItemStyle CssClass="SelectedItemStyle" />
                                                                <pagerstyle font-bold="False" font-italic="False" font-overline="False" font-strikeout="False">
                                                                    Font-Underline="False" Mode="NumericPages" Visible="False" Wrap="False" />
                                                                <alternatingitemstyle cssclass="AlternateItemStyle" />
                                                                <itemstyle cssclass="ItemStyle" />
                                                                <HeaderStyle CssClass="gridHeader" ForeColor="White" />
                                                                <columns>
                                                                    <asp:TemplateColumn HeaderText="Allowance  Description">
                                                                        <itemtemplate>
                                                                            <asp:UpdatePanel ID="updatedropdown" runat="server">
                                                                                <contenttemplate>
                                                                                    <asp:DropDownList ID="ddlAllowancetype" runat="server" CssClass="DropDownDetail"
                                                                                        Width="300px" AutoPostBack="true" OnSelectedIndexChanged="ddlAllowancetype_SelectedIndexChanged">
                                                                                    
                                                                                </contenttemplate>
                                                                            
                                                                        </itemtemplate>
                                                                        <HeaderStyle Width="25px"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Amount">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtamount" runat="server">0</itemtemplate>
                                                                        <HeaderStyle Width="15px"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Taxable Amount">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txttaxableamount" runat="server">0</itemtemplate>
                                                                        <HeaderStyle Width="15px"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Taxfree Amount">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txttaxfreeamount" runat="server">0 </itemtemplate>
                                                                        <HeaderStyle Width="15px"></HeaderStyle>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="Delete" Visible="False">
                                                                        <itemtemplate>
                                                                            <asp:CheckBox ID="chkDeleteData" runat="server" /></itemtemplate>
                                                                        <HeaderTemplate>
                                                                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                                                <contenttemplate>
                                                                                    <asp:CheckBox ID="chkDeleteAllowance" runat="server" AutoPostBack="True" Text="Delete"
                                                                                        OnCheckedChanged="chkDeleteAllowance_CheckedChanged" /></contenttemplate>
                                                                            
                                                                        </HeaderTemplate>
                                                                    
                                                                    <asp:TemplateColumn HeaderText="refid" Visible="false">
                                                                        <itemtemplate>
                                                                            <asp:TextBox ID="txtrefid" runat="server" Visible="false"> </itemtemplate>
                                                                    
                                                                </columns>
                                                            </pagerstyle></contenttemplate>
                                                        <triggers>
                                                            <asp:AsyncPostBackTrigger ControlID="lnkAddAllowanceRow" EventName="Click">
                                                            <asp:AsyncPostBackTrigger ControlID="lnkdeletAllowanceRow" EventName="Click">
                                                        </triggers>
                                                    
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:LinkButton ID="lnkAddAllowanceRow" runat="server" Text="Add New Row" OnClick="lnkAddAllowanceRow_Click">    
                                                    <asp:LinkButton ID="lnkdeletAllowanceRow" runat="server" Text="Delete Row" OnClick="lnkdeletAllowanceRow_Click">
                                                </td>
                                            </tr>
                                        </table>
                                    </contenttemplate>
                                
                            
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:HiddenField ID="hdnsearch" runat="server">
                            <asp:HiddenField ID="hdnSearchVal" runat="server">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td align="right">
                        </td>
                        <td align="left">
                            <asp:ImageButton ID="BtnSave" runat="server" ImageUrl="~/gif button/btn-submit.gif"
                                OnClick="BtnSave_Click" />
                             <asp:ImageButton ID="btnCancel" runat="server" ImageUrl="~/gif button/btn-cancel.gif"
                                OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Panel ID="pnlSearchResult" runat="server" CssClass="modalPopup" Style="display: none"
                                Width="700px">
                                <asp:UpdatePanel ID="UpdatePanelSrchResult" runat="server">
                                    <contenttemplate>
                                        <uc3:UCSearchResult ID="UCSearchResult1"  runat="server">
                                    </contenttemplate>
                                
                            
                            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1"  runat="server" BackgroundCssClass="modalBackground"
                                PopupControlID="pnlSearchResult" TargetControlID="Label3" CancelControlID="Label3"
                                 önCancelScript="HideModalPopupUCSrch()">
                            
                        </td>
                    </tr>
                </table>
Posted
Updated 24-Jul-12 21:01pm
v5
Comments
Sergey Alexandrovich Kryukov 25-Jul-12 1:37am    
How about some code sample to reproduce the problem? Use "Improve question".
--SA
vin105 25-Jul-12 1:42am    
k Sergey Alexandrovich Kryukov

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900