0
我正在循環2個Datagrids並獲取所選人員的IndividualID(PrimaryKeys)。我已經調試過了,循環工作正常。無論如何,當我從我的表適配器調用我的更新方法時,似乎沒有任何事情發生。它不更新。這是我的代碼。不知道我在做什麼錯:嘗試調用按鈕單擊事件中的更新方法
protected void imgbtnReassgin_Click(object sender, ImageClickEventArgs e)
{
foreach (GridViewRow row in gvAdminCustomer.Rows)
{
CheckBox cb = (CheckBox)row.FindControl("chkitemSelectorCustomers");
if (cb != null && cb.Checked)
{
int oIndividualID = Convert.ToInt32((gvAdminCustomer.DataKeys[row.RowIndex].Value));
// GlobalVar.oIndividualID = oIndividualID;
foreach (GridViewRow r in gvReassignCustomers.Rows)
{
CheckBox chkBox = (CheckBox)row.FindControl("chkitemSelectorAllManagersandSalesman");
if (chkBox != null && chkBox.Checked)
{
int oNewParentID = Convert.ToInt32((gvReassignCustomers.DataKeys[r.RowIndex].Value));
individualTableAdapter ind = new individualTableAdapter();
//Individual ind = new Individual();
ind.reassign_Individual(oIndividualID, oNewParentID);
}
}
gvAdminCustomer.DataBind();
}
}
}
它根本沒有更新數據庫。但我會嘗試這種方法。 – 2012-03-01 17:33:11