Using Janus GridEx I created a Grid, it is having few Columns where 9th column (Code) will have a Drop Down and the data in the drop down should be different for different rows, and the drop down values are dependent on the 10th column(CommentQID) value.
But, now I am getting the same values for all drop downs in every row. Please suggest me the changes to achieve different drop down values for different row based on 10th column(CommentQID) value.
What I have tried:
Private Sub UpdateCodeDropdown()
Dim rows As Janus.Windows.GridEX.GridEXRow()
Dim row As Janus.Windows.GridEX.GridEXRow
Dim totRows As Integer = 0, iProofed As Integer = 0, iCoded As Integer = 0
Dim commentQID As Integer = 0
Dim i As Integer = 0
Try
rows = grdProofCodeComments.GetRows()
For Each row In rows
If row.Cells("CommentQID").Text.ToString() IsNot Nothing AndAlso row.Cells("CommentQID").Text.ToString() <> String.Empty Then
commentQID = row.Cells("CommentQID").Value
getCodes(commentQID)
Else : commentQID = 0
grdProofCodeComments.DropDowns("ddCommentCodeQID").ClearItems()
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message, "Error in UpdateStats", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
rows = Nothing
End Try
End Sub
Public Sub getCodes(commentQID As Integer)
Dim sqlCommand As String = "SELECT ad.ADefID, ad.AOrder, ad.ADEValue, AValue= dbo.ufn_GetZeroFilledADeValue(a" & _
"d.ADefID), ad.ADesc, ad.ADescBrief FROM tblQDef q INNER JOIN tblADef ad ON ad.AT" & _"ID = q.ATID WHERE (q.QID = @QID)"
If commentQID <> Nothing Then
Dim ds As DataSet = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sqlCommand, New SqlParameter("@QID", Convert.ToInt32(commentQID))) 'how to pass the integer datatype SQL parameter
grdProofCodeComments.DropDowns("ddCommentCodeQID").SetDataBinding(ds, ds.Tables(0).TableName)
End If
End Sub