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