我正在使用asp:Repeater控件在asp.net应用程序中显示已预订的房间。当用户单击“结帐”按钮时,我正在使用Modal来显示信息。现在,我将从Repeater控件复制该信息以在模式的文本框中显示值。
现在,当用户在模式中单击“签出和打印”按钮时,我正在构建QueryString来将bookingId转移到另一个页面以生成Crystal Reports。但是问题是,当我单击按钮时,QueryString返回的是空值,因此下一页将不会生成报告。 有什么可以解决这个问题的吗?
下面是我用于将Repeater控件的DataBound值复制到模式文本框的所有代码:
$(document).on('click', '.chkmodal', function () {
var bookingid = $(this).closest('section').find('.txtBI1').text();
var room_no = $(this).closest('section').find('.room_no').text();
var cust_name = $(this).closest('section').find('.txtcustname').text();
var checkin = $(this).closest('section').find('.txtcin1').text();
var checkout = $(this).closest('section').find('.txtcout2').text();
var bal = parseFloat($(this).closest('section').find('.txtbal').text());
var Nod = $(this).closest('section').find('.txtNOD1').text();
var advance = $(this).closest('section').find('.txtAdvance1').text();
var extras = $(this).closest('section').find('.txtExtras').text();
var Total = $(this).closest('section').find('.txtTotalA').text();
var CGST = $(this).closest('section').find('.txtCGST1').text();
var Path = $(this).closest('section').find('.txtImgPath').text();
/*var balanceAmt = parseFloat($('.txtbalance').val());*/
var pamt = parseFloat($(this).parent().find('.txtPaidAmt').val());
var res = pamt - bal;
$('.txtBI1').val(bookingid);
//$('.bidnor').val(bookingid);
$('.txtCName').val(room_no);
$('.custName').val(cust_name);
$('.txtcin1').val(checkin);
$('.txtcout2').val(checkout);
$('.txtbal').val(bal);
$('.txtNOD1').val(Nod);
$('.txtAdvance1').val(advance);
$('.txtExtras').val(extras);
$('.txtTotalA').val(Total);
$('.txtCGST1').val(CGST);
$('.txtPath').attr("src", Path);
$('.txtPAIDNOW').val(pamt);
$('.txtGT').val(res);
});
我的中继器控件:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<div class="col-lg-3 col-3 ">
<section class="room">
<div class="small-box bg-success-gradient">
<div class="inner">
<table>
<tr>
<th>
<h4>Room No: <span class="room_no"> <%#Eval("Roomno")%> </span></h4>
</th>
</tr>
<tr>
<td>Booking-ID :</td>
<td class="txtBI1"><asp:Label ID="lblRID" runat="server" Text='<%#Eval("BookingId")%>'></asp:Label> </td>
</tr>
<tr>
<td>NAME :</td>
<td class="txtcustname"><%#Eval("Name")%></td>
</tr>
<tr hidden="">
<td>CHECK-IN :</td>
<td class="txtcin1"><%#Eval("cin")%></td>
</tr>
<tr>
<td>CHECK-OUT :</td>
<td class="txtcout2" style="color: #FFFFFF; font-weight: bolder;"><%#Eval("cout")%></td>
</tr>
<tr>
<td>BALANCE :</td>
<td class="txtbal"><%#Eval("BALANCE")%></td>
</tr>
<tr hidden="">
<td>No. Of Days</td>
<td class="txtNOD1"><%#Eval("NumberOfDays")%></td>
</tr>
<tr hidden="">
<td></td>
<td class="txtAdvance1"><%#Eval("AdvanceAmount")%></td>
</tr>
<tr hidden="">
<td>Extras</td>
<td class="txtExtras"><%#Eval("ExtraBedPerson")%></td>
</tr>
<tr hidden="">
<td>TotalAmount</td>
<td class="txtTotalA"><%#Eval("TotalAmount")%></td>
</tr>
<tr hidden="">
<td>File Path</td>
<td class="txtImgPath"><%#Eval("FilePath")%></td>
</tr>
</table>
<input type="text" class="form-control input-sm txtPaidAmt" name="txtpa" />
</div>
<asp:LinkButton ID="a2" runat="server" CssClass="small-box-footer chkmodal" data-toggle="modal" CausesValidation="false" OnClick="a2_Click3" data-target="#ChkModal" Style="font-weight: bold"><i class="fa fa-sign-out"></i> Check Out</asp:LinkButton>
</div>
</section>
</div>
</ItemTemplate>
</asp:Repeater>
用于绑定Page_Load事件中的转发器控件的代码:
SqlDataAdapter sda = new SqlDataAdapter("Select * From Booking where status='1'", constring);
sda.Fill(dt);
Repeater1.DataSource = dt;
Repeater1.DataBind();
用于构建QueryString的代码:
protected void a2_Click3(object sender, EventArgs e)
{
RepeaterItem item = (sender as LinkButton).NamingContainer as RepeaterItem;
string BID = ac.Encrypt((item.FindControl("lblRID") as Label).Text);
bidr = BID.ToString();
}