Maximus007
Technical User
First I have a question. Can you have a datagrid that allow paging through the records and allow you edit records? I have tried accomplishing that task but not successful. Here's what happens in my application. After paging the record and selecting a record to edit. Once I click on the update button it adds or inserts a that record into the database. Would anyone happen to know why is this happening?
Thank you
R.M
updating code:
Private Sub dgServer_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgServer.UpdateCommand
Dim ServerTable As DstServer.ServersDataTable
ServerTable = DstServer.Servers
Dim ServerRowUpdate As DstServer.ServersRow
ServerRowUpdate = ServerTable.Rows(e.Item.ItemIndex)
ServerRowUpdate.ServerName = CType(e.Item.Cells(1).Controls(0), TextBox).Text
ServerRowUpdate.DateRegistered = Date.Now
SqlDataAdapter1.Update(DstServer)
dgServer.DataSource = DstServer.Servers.DefaultView
dgServer.EditItemIndex = -1
dgServer.DataBind()
End Sub
Thank you
R.M
updating code:
Private Sub dgServer_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgServer.UpdateCommand
Dim ServerTable As DstServer.ServersDataTable
ServerTable = DstServer.Servers
Dim ServerRowUpdate As DstServer.ServersRow
ServerRowUpdate = ServerTable.Rows(e.Item.ItemIndex)
ServerRowUpdate.ServerName = CType(e.Item.Cells(1).Controls(0), TextBox).Text
ServerRowUpdate.DateRegistered = Date.Now
SqlDataAdapter1.Update(DstServer)
dgServer.DataSource = DstServer.Servers.DefaultView
dgServer.EditItemIndex = -1
dgServer.DataBind()
End Sub