SteveoAtilla Posted June 29, 2006 Posted June 29, 2006 Okay, I have an application that I need to create a local DataTable bound to a DataGrid so the user can create their list of parts prior to inserting them into the database. I had been using a simple CheckBoxList, but the formatting limitations were really ticking me off (extraneous spaces removed automatically), so I decided to switch to a bound DataGrid. Here is the code I have for when the user clicks the "Add" button: Dim NewTableRow As System.Data.DataRow = dsSelectedParts.Tables("dtSelectedParts").NewRow() If Len(Trim(txtPartNum.Text)) > 0 Then PartNumber = UCase(txtPartNum.Text) GoodPart = ValidPart(PartNumber) Else GoodPart = False End If If GoodPart Then NewTableRow("RowID") = PartIndex NewTableRow("PartNumber") = Session("PartNum") NewTableRow("PartDesc") = Session("PartDesc") NewTableRow("PartMBS") = Session("PartMBS") NewTableRow("PartRev") = Session("PartRev") NewTableRow("PartDwg") = Session("PartDwg") dsSelectedParts.Tables("dtSelectedParts").Rows.Add(NewTableRow) Dim RowCount As Integer = dsSelectedParts.Tables("dtSelectedParts").Rows.Count.ToString() Session("TempVar") = dsSelectedParts.Tables("dtSelectedParts").Rows(PartIndex).Item("PartDesc").ToString dgSelectedParts.DataBind() I have the code stop on the assignment of Session("TempVar"), and the first time, the PartIndex value is 0, and the Row.Count propery of the table is 1. The second time, the PartIndex value is 1, but the Rows.Count property is STILL 1. What am I missing here? This seems SO SIMPLE!!!! Kahuna Quote The three most important things in life: God, your family, and the Green Bay Packers -- Not necessarily in that order. Winning is not a sometime thing. You don't win once in a while, you don't do things right once in a while, you do them right all the time. Winning is a habit. Unfortunately, so is losing. -- Vincent T. Lombardi
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.