•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 397,789 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,413 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 9483 | Replies: 1
![]() |
•
•
Join Date: Mar 2006
Posts: 18
Reputation:
Rep Power: 3
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:
Rep Power: 3
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
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
- 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


Linear Mode