如何获取嵌套在Repeater1和Repeater2里面的文本框的值

 我来答
匿名用户
2016-07-07
展开全部
//后台获取
protected void btnPay_Click(object sender, EventArgs e)
{
if (rptMest.Items.Count > 0)
{

List<Model.Pay> listPayModel = new List<Model.Pay>();
foreach (RepeaterItem rptitem in this.rptMest.Items)
{
payModel = new Model.Pay();
HiddenField hfID = (HiddenField)rptitem.FindControl("hfID");
Label lblFee = rptitem.FindControl("lblFee") as Label;
TextBox txtPayment = rptitem.FindControl("txtPayment") as TextBox;
TextBox txtNotes = rptitem.FindControl("txtNotes") as TextBox;
TextBox txtPayDate = rptitem.FindControl("txtPayDate") as TextBox;
payModel.OperatingDate = Convert.ToDateTime(txtPayDate.Text);
payModel.Fee = Convert.ToInt32(lblFee.Text);
payModel.ManifestID = hfID.Value;
payModel.CreateUser = CurrentUser.ID;
payModel.OperatingUser = CurrentUser.ID;
payModel.Remark = "";
payModel.Payment = Convert.ToInt32(txtPayment.Text);
listPayModel.Add(payModel);
}
if (payBLL.Add(listPayModel))
{
Common.MessageBox.Show(this.Page, "付款处理成功!");
InitData();
DataBinds();
}
else
{
Common.MessageBox.Show(this.Page, "付款处理失败!");
DataBinds();
}
}
} 前台绑定
<asp:Repeater runat="server" ID="rptMest" OnItemCommand="rptMest_ItemCommand" OnItemDataBound="rptMest_ItemDataBound">
<ItemTemplate>
<tr class="rptTr">
<td>
<asp:HiddenField ID="hfID" Value='<%# Eval("ManifestID")%>' runat="server" />
<a onclick='ShowFrame(<%# Eval("ManifestID")%>)' title="点击查看货单详情" href="javascript:void(0)">
<%# Eval("ManifestID")%>
</a>
</td>
<td>
<asp:Label ID="lblDate" runat="server" Text='<%# Eval("Date","{0:yyyy-MM-dd}")%>'></asp:Label>
</td>
<td >
<asp:Label ID="lblShipper" runat="server" Text='<%# Eval("Shipper")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblConsignee" runat="server" Text='<%# Eval("Consignee")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblCargoAmount" runat="server" Text='<%# Eval("CargoAmount")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblCargoType" runat="server" Text='<%# Eval("CargoType")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblPayment" class="dshk" runat="server" Text='<%# Eval("Payment")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblCheckoutPayment" class="sshk" runat="server" Text='<%# Eval("CheckoutPayment")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblCheckoutNotes" Text='<%# Eval("CheckoutNotes")%>' runat="server"></asp:Label>
</td>
<td>
<asp:Label ID="lblFee" class="sxf" runat="server" Text=""></asp:Label>
</td>
<td>
<asp:Label ID="lblYFPayment" class="yfhk" runat="server" Text=""></asp:Label>
</td>
<td>
<asp:TextBox ID="txtPayDate" Width="80px" onclick="WdatePicker({isShowClear:true,readOnly:false,maxDate:'%y-%M-%d'})" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtPayment" class="sfhk" onkeyup="CheckValue(this)" Width="50px"
MaxLength="10" runat="server"></asp:TextBox>
</td>

<td>
<asp:LinkButton ID="lbnDelete" runat="server" CommandName="Delete">[移除]</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式