Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 22-Jul-16 2:42am

1 solution

It is better to bind your dropdown with binding source and set the dataproertyName to the Id that will get the selected value and set the Valuemember and display Member.
Then fill this bindingSource.datasource in the load event
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900