raysot
New member
- Joined
- Aug 29, 2005
- Messages
- 1
- Programming Experience
- 3-5
I too, have an issue where I have an EDIT column that changes the selected datagrid row to EDIT mode. I make my changes, click on UPDATE, but the call to the database is formed using the old row values and not the new changed values.
I suspect this has something to do with Postback. I am not familiar yet with how postback works. If anyone has any ideas, I would be most appreciative!
My code below:
----------------------------------------------
PrivateSub ReportGrid_UpdateCommand(ByVal source AsObject, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles ReportGrid.UpdateCommand
'Declare Local Variables
Dim iStatusID As Int32 = Nothing
Dim dDateAdded AsDate = Nothing
Dim sProjectTask AsString = Nothing
Dim iPercentComplete As Int32 = Nothing
Dim dDateDue AsDate = Nothing
Dim sStatus AsString = Nothing
Try
'Initialize Local Variables
Label1.Text = e.CommandArgument.ToString().Split("|"c)(0)
iStatusID = Convert.ToInt32(e.CommandArgument.ToString().Split("|"c)(0))
dDateAdded = Convert.ToDateTime(e.CommandArgument.ToString().Split("|"c)(1))
sProjectTask = e.CommandArgument.ToString().Split("|"c)(2)
iPercentComplete = Convert.ToInt32(e.CommandArgument.ToString().Split("|"c)(3))
dDateDue = Convert.ToDateTime(e.CommandArgument.ToString().Split("|"c)(4))
sStatus = e.CommandArgument.ToString().Split("|"c)(5)
'Update tbl_Report_DBAStatus
Call DataAccessLibrary.DataAccess.ExecuteNoResult([Global].ConnectionString, "dbo.usp_Update_MyDBAStatus", iStatusID, dDateAdded, sProjectTask, iPercentComplete, dDateDue, sStatus)
'Reset the edit item index
ReportGrid.EditItemIndex = -1
'Refresh
Call GridFunctions.FillGrid(ReportGrid, "dbo.usp_Report_MyDBAStatus")
Call GridFunctions.HandleSortCommand(ReportGrid, Me.SortBy, "dbo.usp_Report_MyDBAStatus")
Finally
'Clean Up
iStatusID = Nothing
dDateAdded = Nothing
sProjectTask = Nothing
iPercentComplete = Nothing
dDateDue = Nothing
sStatus = Nothing
EndTry
EndSub
I suspect this has something to do with Postback. I am not familiar yet with how postback works. If anyone has any ideas, I would be most appreciative!
My code below:
----------------------------------------------
PrivateSub ReportGrid_UpdateCommand(ByVal source AsObject, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles ReportGrid.UpdateCommand
'Declare Local Variables
Dim iStatusID As Int32 = Nothing
Dim dDateAdded AsDate = Nothing
Dim sProjectTask AsString = Nothing
Dim iPercentComplete As Int32 = Nothing
Dim dDateDue AsDate = Nothing
Dim sStatus AsString = Nothing
Try
'Initialize Local Variables
Label1.Text = e.CommandArgument.ToString().Split("|"c)(0)
iStatusID = Convert.ToInt32(e.CommandArgument.ToString().Split("|"c)(0))
dDateAdded = Convert.ToDateTime(e.CommandArgument.ToString().Split("|"c)(1))
sProjectTask = e.CommandArgument.ToString().Split("|"c)(2)
iPercentComplete = Convert.ToInt32(e.CommandArgument.ToString().Split("|"c)(3))
dDateDue = Convert.ToDateTime(e.CommandArgument.ToString().Split("|"c)(4))
sStatus = e.CommandArgument.ToString().Split("|"c)(5)
'Update tbl_Report_DBAStatus
Call DataAccessLibrary.DataAccess.ExecuteNoResult([Global].ConnectionString, "dbo.usp_Update_MyDBAStatus", iStatusID, dDateAdded, sProjectTask, iPercentComplete, dDateDue, sStatus)
'Reset the edit item index
ReportGrid.EditItemIndex = -1
'Refresh
Call GridFunctions.FillGrid(ReportGrid, "dbo.usp_Report_MyDBAStatus")
Call GridFunctions.HandleSortCommand(ReportGrid, Me.SortBy, "dbo.usp_Report_MyDBAStatus")
Finally
'Clean Up
iStatusID = Nothing
dDateAdded = Nothing
sProjectTask = Nothing
iPercentComplete = Nothing
dDateDue = Nothing
sStatus = Nothing
EndTry
EndSub