C# 在Repeater中编辑文本框
我有一个内置文本框的中继器。我试图编辑文本框中的信息,检索新数据,并写入数据库。用我的代码,它给了我盒子里的原始信息。不是我添加的新信息。这是我的密码 html:C# 在Repeater中编辑文本框,c#,asp.net,repeater,C#,Asp.net,Repeater,我有一个内置文本框的中继器。我试图编辑文本框中的信息,检索新数据,并写入数据库。用我的代码,它给了我盒子里的原始信息。不是我添加的新信息。这是我的密码 html: 请确保通过签入页面加载将数据绑定到中继器 if(!IsPostBack) BindData(); 是的,我要订日期。有130行代码。我疲于将注意力集中到最令人担忧的领域。事实上,你是对的。我把它装订在另一页上,还以为它也在这一页上。谢谢你的帮助。@dan:很高兴我的调整帮助了你:) protected void ReviewRe
请确保通过签入页面加载将数据绑定到中继器
if(!IsPostBack)
BindData();
是的,我要订日期。有130行代码。我疲于将注意力集中到最令人担忧的领域。事实上,你是对的。我把它装订在另一页上,还以为它也在这一页上。谢谢你的帮助。@dan:很高兴我的调整帮助了你:)
protected void ReviewRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
Review review = (Review)e.Item.DataItem;
TextBox titleLabel = (TextBox)e.Item.FindControl("titleLabel");
titleLabel.Text = review.Title;
}
}
protected void saveReviewLinkButton_OnCommand(object sender, EventArgs e)
{
TextBox titleLabel = new TextBox();
foreach (RepeaterItem dataItem in ReviewRepeater.Items)
{
titleLabel = (TextBox)dataItem.FindControl("titleLabel");
string newInfo = titleLabel.Text;
}
}
if(!IsPostBack)
BindData();