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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.