Here, When I Click On "+" Button. then Jquery Popup Opens and Then in TextBox txtTotalCarat and txtTTotalAmount Gets Value from calculating from back end code. When I Click On Submit Button. Click Event is Firing and in Debug mode I can see That Value is Transferring to Main Page Textbox txtInvoiceCarats and txtInvoiceAmount. But The Problem here is After Finishing Click Event Popup Is not getting Close and Values not Showing In Main Page Textbox txtInvoiceCarats and txtInvoiceAmount. Please Help Me To Solve This Problem.
<script type = "text/javascript">
function ShowTotal() {
$.ajax({
type: "POST",
url: "Admin/AddSales.aspx/GetTotal",
data: '{TCarats: "' + $("#<%=txtTotalCarats.ClientID%>")[0].value + '", TAmount: "' + $("#<%=txtTTotalAmount.ClientID%>")[1].value + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function(response) {
alert(response.d);
}
});
}
function OnSuccess(response) {
alert(response.d);
}
</script>
<asp:UpdatePanel ID="updSales" runat="server" UpdateMode="Conditional"
ChildrenAsTriggers="true">
<ContentTemplate>
<div class=" form-horizontal">
<hr />
<table align="center" style="width:100%;">
<tr>
<td align="center" style="width:33.33%;">
<div class="form-group">
<div class="col-lg-12">
<asp:TextBox ID="txtInvoiceCarats" CssClass="form-control" runat="server" style="width:80%; display:inline-block;" placeholder="Invoice Carats"></asp:TextBox>
<asp:Button ID="btnAddCaratDetails" runat="server" Text="+" CssClass="btn btn-success" OnClick="btnAddCaratDetails_Click" />
</div>
</div>
</td>
<td align="center">
<div class="form-group">
<div class="col-lg-12">
<asp:TextBox ID="txtInvoiceAmount" CssClass="form-control" runat="server" style = "width:90%;" placeholder="Invoice Amount"></asp:TextBox>
</div>
</div>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
**//Below Code for PopUp On The Same Page**
<asp:UpdatePanel ID="updSalesDetails" runat="server"
UpdateMode="Conditional" ChildrenAsTriggers="True">
<ContentTemplate>
<div class="form-horizontal">
<table align="center" style="width:100%;">
<tr>
<td align="center">
<div id="editModal" class="modal fade" data-backdrop="" style="top:15%;left:0%;margin:-50px 0 0 -1000px; " tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="width:1600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="editModalLabel">Add Sales Details</h3>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<table style="width:100%;">
<tr>
<td style = "width:2%;" align="center">
<div class="form-group">
<div class="col-lg-12">
<asp:TextBox ID="txtTotalCarats" CssClass="form-control" runat="server" Font-Bold="true" style = "width:95%; background-color:lightgreen;" Enabled="false" placeholder="Total Carats"></asp:TextBox>
</div>
</div>
</td>
<td>
<div>
<div class="col-lg-12">
<asp:TextBox ID="txtTTotalAmount" CssClass="form-control" runat="server" Font-Bold="true" style = "width:90%; background-color:lightgreen;" Enabled="false" placeholder="Grand Amount"></asp:TextBox>
</div>
</div>
</td>
</tr>
</table>
<div class="modal-footer">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="btn btn-success" UseSubmitBehavior="false" data-dismiss="modal" OnClientClick="ShowTotal()" />
<asp:Button ID="btnReset" runat="server" Text="Reset" CssClass="btn btn-warning" OnClick="btnReset_Click" />
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnReset" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Code Behind
[System.Web.Services.WebMethod]
public void GetTotal(string TCarats,string TAmount)
{
txtInvoiceCarats.Text = TCarats.ToString();
txtInvoiceAmount.Text = TAmount.ToString();
}