D
DJONES
I am new to ASP.Net programming, and I'm trying to get my datagrid control to funtion as needed (with edit capabilities). Any help/advice would be greatly appreciated.
--Error when Update is clicked-
Server Error in '/AP Manager' Application
-------------------------------------------------------------------------------
Column 'Override Code' is read only.
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.Data.ReadOnlyException: Column 'Override Code' is read only
Source Error:
Line 489: End Ge
Line 490: Se
Line 491: Me(Me.tabletbl04aSIP_Disc.Override_CodeColumn) = valu
Line 492: End Se
Line 493: End Propert
--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 Strin
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_Code = O
r.Pay_Qty = P
r.Pay_Amt = 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(
--Error when Update is clicked-
Server Error in '/AP Manager' Application
-------------------------------------------------------------------------------
Column 'Override Code' is read only.
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.Data.ReadOnlyException: Column 'Override Code' is read only
Source Error:
Line 489: End Ge
Line 490: Se
Line 491: Me(Me.tabletbl04aSIP_Disc.Override_CodeColumn) = valu
Line 492: End Se
Line 493: End Propert
--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 Strin
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_Code = O
r.Pay_Qty = P
r.Pay_Amt = 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(