0

Hi,
I'm using the DataGrid control with databound columns. I have an EditCommandColumn to allow for the Edit of the row. I'm having trouble retrieving the values of the row being edited in the UpdateCommand event.

For example e.Item.Cells(4).Text and DataGrid1.Items(lCurrRow).Cells(4).Text always returns a blank value instead of the value in the cell.

Does anyone know how to access the cell values from the row being updated a DataGrid control from the UpdateCommand event?

The command: DirectCast(e.Item.FindControl("txtBox1", TextBox).Text works fine for retrieving TemplateColumn type columns, but not databound columns.

Thanks

1
Contributor
1
Reply
2
Views
10 Years
Discussion Span
Last Post by mikefitz
0

The following code worked to retrieve the cell value from the row currently being edited (DataGrid1.EditItemIndex = e.Item.ItemIndex)

Dim obj As Object = e.Item.Cells(1).Controls(0)
sCellValue = DirectCast(obj, TextBox).Text


Hi,
I'm using the DataGrid control with databound columns. I have an EditCommandColumn to allow for the Edit of the row. I'm having trouble retrieving the values of the row being edited in the UpdateCommand event.

For example e.Item.Cells(4).Text and DataGrid1.Items(lCurrRow).Cells(4).Text always returns a blank value instead of the value in the cell.

Does anyone know how to access the cell values from the row being updated a DataGrid control from the UpdateCommand event?

The command: DirectCast(e.Item.FindControl("txtBox1", TextBox).Text works fine for retrieving TemplateColumn type columns, but not databound columns.

Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.