I thought I finally had the answer on how to perform updates on a datagrid. I copied the basic procedure right from msdn at:
Here's my code on the datagrid update event:
Private Sub DGusers_UpdateCommand(ByVa
l source As Object, ByVal e As System.Web.UI.WebControls.
Args) Handles DGusers.UpdateCommand
'A Generic Update
Dim CategoryDescript As String
Dim key As String = DGusers.DataKeys(e.Item.It
Dim tb As TextBox
tb = CType(e.Item.Cells(0).Cont
rols(0), TextBox) <<<<<<<<<<<<<<<<< ERROR OCCURS HERE
col1 = tb.Text
This is the Error I get:
Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastExceptio
n: Specified cast is not valid.
Line 187: Dim tx As String
Line 189: tb = CType(e.Item.Cells(0).Cont
Line 190: col1 = tb.Text
This was an example based right out of msdn and I am mystified.
Has anyone been able to resolve this?
Everything else seems to be working fine except for this.