I have a datagrid that will not update using the update command. The delete command works great, but the update command returns the original value. I have checked that the DataKeyName matches the key in the database.
I have a dropdown on the page that is used to select a WorkOrder, which then displays the records in the datagrid. My guess is that it has something to do with a postback that forces the datagrid to the original value from the dropdown instead of the update
information.
Partial Class WorkOrders_Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
WorkOrder.ClearSelection()
WorkOrder.SelectedValue = Request.QueryString("WorkOrder")
End If
End Sub
Protected Sub id_SelectedIndexChanged(sender As Object, e As EventArgs) Handles WorkOrder.SelectedIndexChanged
WordOrderLabel.Text = WorkOrder.SelectedItem.Text.ToString()
End Sub
Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
End Sub
End Class
None
0 Points
2 Posts
DataGrid Update Not Working
Jan 22, 2017 01:51 AM|mueller547|LINK
I have a datagrid that will not update using the update command. The delete command works great, but the update command returns the original value. I have checked that the DataKeyName matches the key in the database.
I have a dropdown on the page that is used to select a WorkOrder, which then displays the records in the datagrid. My guess is that it has something to do with a postback that forces the datagrid to the original value from the dropdown instead of the update information.
Any help would be appreciated. Thanks.
All-Star
52503 Points
15665 Posts
Re: DataGrid Update Not Working
Jan 22, 2017 07:30 AM|oned_gk|LINK
How about updating quantity? seem like update command will update quatity only.
Suwandi - Non Graduate Programmer
None
0 Points
2 Posts
Re: DataGrid Update Not Working
Jan 22, 2017 11:01 PM|mueller547|LINK
Quantity is the only thing that I want it to update. It doesn't work. I change the quantity number and it reverts back to the original number.
All-Star
52503 Points
15665 Posts
Re: DataGrid Update Not Working
Jan 23, 2017 01:00 AM|oned_gk|LINK
Try modify this
For sql server it will not effect, but i don't know the database you use
Suwandi - Non Graduate Programmer