如何获取嵌套在Repeater1和Repeater2里面的文本框的值
1个回答
展开全部
//后台获取
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);
}
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);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询