当你使用服务器控件,在repeater中放入服务器控件时designer.cs文件中怎么都不会出现你拖拉的控件时,对于新手的我来说很麻烦
现在使用后台的方法暂时实现功能,具体代码如下:
protected void Button2_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in repConParList.Items) //repeater控件
{
Label lblId = (Label)item.FindControl("lblId");
string id = lblId.Text;
System.Web.UI.HtmlControls.HtmlSelect sel_type = (System.Web.UI.HtmlControls.HtmlSelect)item.FindControl("sel_type");
System.Web.UI.HtmlControls.HtmlInputText txt_ReceiveGift = (System.Web.UI.HtmlControls.HtmlInputText)item.FindControl("txt_ReceiveGift");
System.Web.UI.HtmlControls.HtmlInputCheckBox cbReceive = (System.Web.UI.HtmlControls.HtmlInputCheckBox)item.FindControl("cbReceive");
System.Web.UI.HtmlControls.HtmlInputCheckBox cbReceived = (System.Web.UI.HtmlControls.HtmlInputCheckBox)item.FindControl("cbReceived"); System.Web.UI.HtmlControls.HtmlInputText txt_Receipt = (System.Web.UI.HtmlControls.HtmlInputText)item.FindControl("txt_Receipt");
System.Web.UI.HtmlControls.HtmlInputText txt_Invoice = (System.Web.UI.HtmlControls.HtmlInputText)item.FindControl("txt_Invoice");
Label lblusername = (Label)item.FindControl("lblusername");
Parkingfeemodel = new Model.ParkingFee();
Parkingfeemodel.MoneyType = sel_type.SelectedIndex.ToString();
string n = txt_ReceiveGift.Value;
Parkingfeemodel.ReceiveGift = int.Parse(n);
Parkingfeemodel.Receive =1;
Parkingfeemodel.Received = 1;
string i = txt_Receipt.Value;
Parkingfeemodel.Receipt = int.Parse(i);
string t = txt_Invoice.Value;
Parkingfeemodel.Invoice = int.Parse(t);
lblusername.Text = SessionInfo.User.UserName;
Parkingfeemodel.TransferName = lblusername.Text;
Parkingfeemodel.Id = int.Parse(id);
parkingfeeservice.UpdateParkingFee(Parkingfeemodel);
}
Bind();
}