When I click the Linkbutton2 the entire page is reloaded. However if I simply remove the id="addLineModal" div but keep its contents intact, when I then click the Linkbutton2, the updatepanel works properly. Any ideas why a modal would break the updatepanel? Here is the code:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="PriceAndLeadTimeRequest.aspx.vb" Inherits="PriceAndLeadTimeRequest" %>
<%@ MasterType VirtualPath="./MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:LinkButton ID="OpenTheModal" runat="server" CssClass="btn btn-sm btn-primary" Style="margin-top: 7px;" data-toggle="modal" data-target="#addLineModal"><i class="fa fa-plus"></i> Add New Line Item</asp:LinkButton>
<asp:UpdatePanel ID="udpAddLineModal" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal inmodal fade" id="addLineModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-10">
<div class="form-group" runat="server" id="divCollection">
<label class="col-xs-3 control-label">Press:</label>
<div class="col-xs-9">
<asp:LinkButton ID="LinkButton2" runat="server">LinkButton</asp:LinkButton>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script>
<script src="js/plugins/pace/pace.min.js"></script>
<!-- Jquery Validate -->
<script src="js/plugins/validate/jquery.validate.min.js"></script>
<!-- jQuery UI -->
<script src="js/plugins/jquery-ui/jquery-ui.min.js"></script>
</asp:Content>
I found what was wrong. I will post the answer here as I couldn't find anything else out there on Google on this issue. Here were the problems:
The slimscroll file was the main culprit in causing the updatepanel to do a full page postback. I commented it out.
The other reason why the updatepanel was doing a full page postback, in addition to the slimscroll file, was because in the masterpage, I have ClientIDMode="Static". I had to set the dropdown to ClientIDMode="AutoID"
The last thing I had to do, in order to avoid the modal from disappearing, I had to move the updatepanel inside the modal-content div instead of containing the whole modal in the updatepanel.
Hope this prevents someone else out there from losing their minds like I almost did! :)