在这里,当我单击“ +”按钮时。然后打开Jquery Popup,然后在TextBox中的txtTotalCarat和txtTTotalAmount从后端代码的计算中获取值。当我单击“提交”按钮时。单击事件正在触发,在调试模式下,我可以看到该值正在传输到主页文本框txtInvoiceCarats和txtInvoiceAmount。 但是这里的问题是完成单击事件弹出框后没有关闭并且值未显示在主页文本框中txtInvoiceCarats和txtInvoiceAmount。 请帮我解决这个问题。
<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();
}