I'm developing an asp.net website. I use nested updatePanels in my code. Piece of code causing the problem:
<asp:UpdatePanel runat="server" ID="UpdatePanel15" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1"/>
</Triggers>
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel10" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_search_" />
</Triggers>
<ContentTemplate>
<asp:DropDownList ID="txtId" runat="server" CssClass="form-control">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:TextBox ID="Txt_search_" runat="server" ClientIDMode="Static" CssClass="form-control"></asp:TextBox>
<asp:Button ID="btn_search_" runat="server" Text="بحث" CssClass="btn btn-primary" OnClick="search_list" />
<asp:DropDownList ID="DropDowntypes" runat="server" AutoPostBack="false" CssClass="form-control">
<asp:ListItem Enabled="true" Text="" Value=""></asp:ListItem>
</asp:DropDownList>
<asp:FileUpload ID="FUpload" AllowMultiple="true" runat="server" CssClass="form-control" />
<asp:Button ID="Button1" runat="server" Text="إضافة" CssClass="btn btn-primary" OnClick="btnAddDoc_Click" OnClientClick="ShowLoading();" />
</ContentTemplate>
</asp:UpdatePanel>
When i click on btn_search_
button every thing goes well, but when i click on Button1
i got this error :Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
which i handled by this script: <script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) { if (args.get_error() != undefined) { args.set_errorHandled(true); } } </script>
On the server's event viewer i found this error:
What is causing this exception? How to Solve this issue? Note: Every this is working on localhost the problem appears on the server.