0
注意:我没有实现上述解决方案,但关闭此问题并接受这个答案,即使你我没有实现。比较旧值与新值并更新
做什么是最好的方法?并且我知道我可以将转发器存储在不同的变种中并进行比较,但我只是想知道优雅的做法。
这里是我for loop
代码,我想比较和更新已更改的值而忽略没有改变
GridViewRow row = gv.SelectedRow;
Repeater _rpt = gv.Rows[e.RowIndex].Cells[8].FindControl("rptReg") as Repeater;
Repeater _rpt1 = gv.Rows[e.RowIndex].Cells[9].FindControl("rptVisitor") as Repeater;
for (int i = 0; i < _rpt.Items.Count; i++) {
TextBox _txt = _rpt.Items[i].FindControl("txtId") as TextBox;
TextBox _txt1 = _rpt.Items[i].FindControl("txtName") as TextBox;
if (_rpt1.Items.Count > i)
TextBox _txt3 = _rpt1.Items[i].FindControl("txtVisitor") as TextBox;
//update db
}
}
不知道会在我的情况的工作和我在EditItemTemplate中使用中继器` 的 的'/> ItemTemplate> asp:Repeater> EditItemTemplate>` –
2011-02-09 19:16:56