G
Guest
I've created several columns at run time and added these to my datagrid using
the following:
Select Case templateType
Case ListItemType.Header
lc = New Literal
lc.Text = "<B>" & columnName & "</B>"
container.Controls.Add(lc)
Case ListItemType.Item
myLabel = New Label
myLabel.ID = "lbl" & columnName
container.Controls.Add(myLabel)
AddHandler myLabel.DataBinding, AddressOf myLabel_DataBinding
Case ListItemType.EditItem
myTextBox = New TextBox
myTextBox.ID = "txt" & columnName & "Edit"
container.Controls.Add(myTextBox)
AddHandler myTextBox.DataBinding, AddressOf
myTextBox_DataBinding
Case ListItemType.Footer
myTextBox = New TextBox
myTextBox.ID = "txt" & columnName
container.Controls.Add(myTextBox)
End Select
When I bind to the grid it displays the data perfectly.
However, I cannot get data out of the grid. For example, I know I have a
column called Line Nbr which contains an EditItem text box called
txtLineNbrEdit. When I change the value I cannot read it.
If I do e.item.cells(0) I get no value.
If I do e.item.cells(0).FindControl("txtLineNbrEdit") it finds nothing.
I cannot get data out of the footer either.
I've tried everything I can think of but to no avail. Can anyone help?
Thanks
Simon
the following:
Select Case templateType
Case ListItemType.Header
lc = New Literal
lc.Text = "<B>" & columnName & "</B>"
container.Controls.Add(lc)
Case ListItemType.Item
myLabel = New Label
myLabel.ID = "lbl" & columnName
container.Controls.Add(myLabel)
AddHandler myLabel.DataBinding, AddressOf myLabel_DataBinding
Case ListItemType.EditItem
myTextBox = New TextBox
myTextBox.ID = "txt" & columnName & "Edit"
container.Controls.Add(myTextBox)
AddHandler myTextBox.DataBinding, AddressOf
myTextBox_DataBinding
Case ListItemType.Footer
myTextBox = New TextBox
myTextBox.ID = "txt" & columnName
container.Controls.Add(myTextBox)
End Select
When I bind to the grid it displays the data perfectly.
However, I cannot get data out of the grid. For example, I know I have a
column called Line Nbr which contains an EditItem text box called
txtLineNbrEdit. When I change the value I cannot read it.
If I do e.item.cells(0) I get no value.
If I do e.item.cells(0).FindControl("txtLineNbrEdit") it finds nothing.
I cannot get data out of the footer either.
I've tried everything I can think of but to no avail. Can anyone help?
Thanks
Simon