rzendler

rzendler

  • NA
  • 3
  • 0

ListControl - DataBinding (Update)

Feb 18 2004 1:41 PM
I am having an issue with a web form list control that I have bound to a DataTable that I create within in my code. Everything works fine when I add a new record to the datatable. My issues happen when I go an update a column in the table. I end up losing a row in the list control. The table still maintains the correct data but the list control is incorrect in all aspects. Questions: Is this a known bug ? Is there a way to force the update (refresh, invalidate don't work). Table: Has a primary Key and one column that is set to be unique. ListControl. Single column DataSournce = equals the table neam Display = The primary key name "Name". Here is my update code UserDataTbl.Rows[i].BeginEdit(); UserDataTbl.Rows[i]["DisplayName"]= txtName.Text; UserDataTbl.Rows[i]["GID"] = txtGroupID.Text; UserDataTbl.Rows[i]["Note"] = txtNote.Text; UserDataTbl.Rows[i]["UserIni"] = txtIniFile.Text; UserDataTbl.Rows[i]["UID"] = txtUserId.Text; UserDataTbl.Rows[i]["LoginDir"] = txtHomeDir.Text; UserDataTbl.Rows[i]["UserIdeFile"] = txtDefaultDoc.Text; try { UserDataTbl.Rows[i].EndEdit(); } catch(Exception e) { MessageBox.Show(e.Message.ToString()); UserList.SelectedIndex = i; UserDataTbl.Rows[i].CancelEdit(); if(e.Message.ToString().IndexOf("UID") != -1) txtUserId.BackColor = System.Drawing.Color.Red; return; } if (iTemp > iHUID) iHUID = iTemp; bUpdateOnExit = true;