Wolfert
Newcomer
Hi (my first post):
I have a main datagrid which show outstanding orders. When the user clicks a item in the datagrid (Buttoncolumn) the second datagrid appears at the bottom of the page showing all orderlines (dgConfirm).
I want the user to edit the gdConfirm datagrid but this somehow doesn't work. The edit button is shown but when I press it, a empty datagrid is shown with nothing to edit.
The feedDgConfirm is called when the ButtomColumn in the main datagrid is pressed.
Somehow the editCommand doesn't get fired.
I have a main datagrid which show outstanding orders. When the user clicks a item in the datagrid (Buttoncolumn) the second datagrid appears at the bottom of the page showing all orderlines (dgConfirm).
I want the user to edit the gdConfirm datagrid but this somehow doesn't work. The edit button is shown but when I press it, a empty datagrid is shown with nothing to edit.
The feedDgConfirm is called when the ButtomColumn in the main datagrid is pressed.
Visual Basic:
Private Sub feedDgConfirm(ByVal PortalID As String)
'feed dgConfirm with proper data
conPortal.Open()
Dim strSQL As New String("SELECT dbo.[Portal - Purchase Orders].ID, dbo.[Portal - Purchase Orders].Line, dbo.[Base - Partnumbers].FusitePart, " _
& "dbo.DBFART.ARTCODE_00, dbo.[Portal - Purchase Orders].Quantity, dbo.[Portal - Purchase Orders].ReqDelivery, " _
& "dbo.[Portal - Purchase Orders].ConfDelivery, dbo.[Portal - Purchase Orders].ConfQuantity " _
& "FROM dbo.[Portal - Purchase Orders] INNER JOIN dbo.[Base - Partnumbers] ON " _
& "dbo.[Portal - Purchase Orders].Customer = dbo.[Base - Partnumbers].Customer AND " _
& "dbo.[Portal - Purchase Orders].Partnr = dbo.[Base - Partnumbers].Partnr INNER JOIN " _
& "dbo.DBFART ON dbo.[Base - Partnumbers].FusitePart = dbo.DBFART.ARTCODE_00 " _
& "WHERE (dbo.[Portal - Purchase Orders].ID = N'" & PortalID & "')")
Dim dsConfirm As New DataSet
Dim daConfirm As New SqlDataAdapter(strSQL, conPortal)
'Set columns
Dim ecbEdit As New EditCommandColumn
ecbEdit.EditText = "Edit info"
ecbEdit.ButtonType = ButtonColumnType.PushButton
ecbEdit.UpdateText = "Update"
ecbEdit.CancelText = "Cancel"
Me.dgConfirm.Columns.Add(ecbEdit)
Dim bcOrderID As New BoundColumn
bcOrderID.HeaderText = "ID"
bcOrderID.DataField = "ID"
Me.dgConfirm.Columns.Add(bcOrderID)
Dim bcLine As New BoundColumn
bcLine.HeaderText = "Orderline"
bcLine.DataField = "Line"
Me.dgConfirm.Columns.Add(bcLine)
Dim bcPart As New BoundColumn
bcPart.HeaderText = "Partnr"
bcPart.DataField = "FusitePart"
Me.dgConfirm.Columns.Add(bcPart)
Dim bcDescription As New BoundColumn
bcDescription.HeaderText = "Description"
bcDescription.DataField = "ARTCODE_00"
Me.dgConfirm.Columns.Add(bcDescription)
Dim bcQuantity As New BoundColumn
bcQuantity.HeaderText = "Qnty requested"
bcQuantity.DataField = "Quantity"
Me.dgConfirm.Columns.Add(bcQuantity)
Dim bcConfQuantity As New BoundColumn
bcConfQuantity.HeaderText = "Qnty Conf."
bcConfQuantity.DataField = "ConfQuantity"
Me.dgConfirm.Columns.Add(bcConfQuantity)
Dim bcDelivery As New BoundColumn
bcDelivery.HeaderText = "Req. delivery"
bcDelivery.DataField = "ReqDelivery"
bcDelivery.DataFormatString = "{0:dd-MM-yyyy}"
Me.dgConfirm.Columns.Add(bcDelivery)
Dim bcConfDelivery As New BoundColumn
bcConfDelivery.HeaderText = "Conf. del."
bcConfDelivery.DataField = "ConfDelivery"
bcConfDelivery.DataFormatString = "{0:dd-MM-yyyy}"
Me.dgConfirm.Columns.Add(bcConfDelivery)
Me.dgConfirm.AutoGenerateColumns = False
me.dgConfirm.
daConfirm.Fill(dsConfirm)
Me.dgConfirm.DataSource = dsConfirm
Me.dgConfirm.DataBind()
conPortal.Close()
End Sub
Private Sub dgOutstanding_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgOutstanding.ItemCommand
'Take actions on click events on buttoncolumns
Dim strID As New String(e.Item.Cells(2).Text)
feedDgConfirm(strID)
End Sub
Private Sub dgConfirm_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgConfirm.EditCommand
dgConfirm.EditItemIndex = e.Item.ItemIndex
feedDgConfirm(e.Item.Cells(2).Text.ToString)
End Sub
Somehow the editCommand doesn't get fired.
Last edited: