| | |
Getting Current Row Values in the DataGrid control
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2006
Posts: 18
Reputation:
Solved Threads: 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
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
•
•
Join Date: Mar 2006
Posts: 18
Reputation:
Solved Threads: 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
Dim obj As Object = e.Item.Cells(1).Controls(0)
sCellValue = DirectCast(obj, TextBox).Text
•
•
•
•
Originally Posted by mikefitz
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
![]() |
Similar Threads
- How to set attribute to the controls in datagrid? (ASP.NET)
- FlexGrid issue and error "Invalid Row value".... (Visual Basic 4 / 5 / 6)
- Vertical Scroll for DataGrid control (ASP.NET)
- How to update a Datagrid cell in Javascript (C#)
- Anyway to display the Row Number in DataGrid? (ASP.NET)
- DataGrid - Column help needed (Visual Basic 4 / 5 / 6)
Other Threads in the ASP.NET Forum
- Previous Thread: Data Binding to a Drop Down List?
- Next Thread: Exporting Reports to MS Excel
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible complex content contenttype control countryselector courier database datagrid datagridview datalist deployment development dgv dialog dropdown dropdownmenu dynamic dynamically edit editing embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv folder form gridview gudi iis image javascript languages list maps menu mobile mssql nameisnotdeclared novell opera order parent problem profile ratings redirect refer registration relationaldatabases reportemail response.redirect rows search security select serializesmo.table sessionvariables silverlight smoobjects software sql ssl tracking treeview typeof validatedate validation vb.net vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment wizard xsl





