D
DJONES
Can someone help with this issue? Here is my error (my code follows)
Error
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.InvalidCastException: Specified cast is not valid
Source Error:
Line 200: Dim OC, PQ, PA As Intege
Line 201: Dim tb As TextBo
Line 202: tb = CType(e.Item.Cells(0).Controls(0), TextBox
Line 203: OC = tb.Tex
Line 204: tb = CType(e.Item.Cells(1).Controls(0), TextBox
Code
Private Sub dgDiscIP_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDiscIP.UpdateComman
'Identify what datagrid row was update
Dim key As String = dgDiscIP.DataKeys(e.Item.ItemIndex).ToString(
'get changed values out of the datagrid ro
Dim OC, PQ, PA As Intege
Dim tb As TextBo
tb = CType(e.Item.Cells(0).Controls(0), TextBox
OC = tb.Tex
tb = CType(e.Item.Cells(1).Controls(0), TextBox
PQ = tb.Tex
tb = CType(e.Item.Cells(2).Controls(0), TextBox
PA = tb.Tex
'Find corresponding row in the data tabl
Dim r As dsIP.tbl04aSIP_DiscRo
r = DsIP1.tbl04aSIP_Disc.FindBySEQ(key
'Update the Row by changing values in the row you located abov
r.Override = O
r.Qty_Alt = P
r.Amt_Alt = P
'Send changes from the dataset to the database by calling the DA's Update Metho
SqlDataAdapter1.Update(DsIP1
dgDiscIP.DataBind(
'Switch the current row in the grid out of edit mod
dgDiscIP.EditItemIndex = -
dgDiscIP.DataBind(
End Sub
Error
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.InvalidCastException: Specified cast is not valid
Source Error:
Line 200: Dim OC, PQ, PA As Intege
Line 201: Dim tb As TextBo
Line 202: tb = CType(e.Item.Cells(0).Controls(0), TextBox
Line 203: OC = tb.Tex
Line 204: tb = CType(e.Item.Cells(1).Controls(0), TextBox
Code
Private Sub dgDiscIP_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDiscIP.UpdateComman
'Identify what datagrid row was update
Dim key As String = dgDiscIP.DataKeys(e.Item.ItemIndex).ToString(
'get changed values out of the datagrid ro
Dim OC, PQ, PA As Intege
Dim tb As TextBo
tb = CType(e.Item.Cells(0).Controls(0), TextBox
OC = tb.Tex
tb = CType(e.Item.Cells(1).Controls(0), TextBox
PQ = tb.Tex
tb = CType(e.Item.Cells(2).Controls(0), TextBox
PA = tb.Tex
'Find corresponding row in the data tabl
Dim r As dsIP.tbl04aSIP_DiscRo
r = DsIP1.tbl04aSIP_Disc.FindBySEQ(key
'Update the Row by changing values in the row you located abov
r.Override = O
r.Qty_Alt = P
r.Amt_Alt = P
'Send changes from the dataset to the database by calling the DA's Update Metho
SqlDataAdapter1.Update(DsIP1
dgDiscIP.DataBind(
'Switch the current row in the grid out of edit mod
dgDiscIP.EditItemIndex = -
dgDiscIP.DataBind(
End Sub