(Jonathon)
12/25/2002 10:26:00 PM
I have a question about a post from Anand Hegde
From Anand Hegde (anandhegde@onlinemicrosoft.com)
Subject: Re: HOWTO: A new way to insert rows in a DataGrid
Newsgroups: microsoft.public.dotnet.framework.aspnet
Date: 2002-03-26 15:44:45 PST
In it you explained more about how to add a new record to a datagrid
using the following syntax:
DataGrid1.Controls(0).Controls.AddAt_
(Me.DataGrid1.SelectedIndex + 3, dgitem)
That works wonderfully but how do you get to the data after entering
in information.
I have a textbox in one of the TableCells that I'm adding to the
datagrid.
Dim mycell3 As New TableCell()
Dim myTextbox3 As New TextBox()
myTextbox3.Width = System.Web.UI.WebControls.Unit.Pixel(75)
mycell3.Controls.Add(myTextbox3)
dgitem.Cells.Add(mycell3)
It displays fine.
If I refer to the row number for the insert row, it references the row
after the inserted item.
If I refer to the row before the inserted row, it references the row
before the inserted item.
I can't seem to refer to the row I added.
I'm using the following code to work with the information in the other
rows.
Dim tb As TextBox
tb = CType(DataGrid1.Items(2).Cells(2).Controls(1), TextBox)
PlanDate = tb.Text
As long as I'm refering to a row that was in the datagrid from when it
was bound to the dataset, I can reference the textbox.
I am unable to get the information out of the inserted row.
Help!!!
Thanks for any help you can give me,