MayoorPatel
Programmer
Hi there I have a category and subcategory dropdown on my form as follows
However I want to have another 4 of these with different ID's. The code used to set the selected item is as follows
Can somebody reccomend how I could amend my code to cater for multiple dropdowns with similar names ID's for instance the category dropdown is called drpMainCategory and the subcategory is called drpMainSubCategory. I want to name the others
drpMainCategory1, drpMainCategory2, drpMainCategory3, drpMainCategory4, drpMainCategory5
drpMainSubCategory1, drpMainSubCategory2, drpMainSubCategory3, drpMainSubCategory4, drpMainSubCategory5
I will also have to change the structure of my database so that the tables show the dropdown ID of the subcategory but for now I just want to know how to loop through the dropdown elements.
Thanks
However I want to have another 4 of these with different ID's. The code used to set the selected item is as follows
Code:
If Not ds.Tables(2).Rows.Count = 0 Then
drpMainCategory.Items.FindByValue(ds.Tables(2).Rows(0)("num")).Selected = True
Utility.PopulateSubCategory(drpMainSubCategory, ds.Tables(2).Rows(0)("num"))
For Each row As DataRow In ds.Tables(2).Rows
drpMainSubCategory.Items.FindByValue(row("subcategoryid")).Selected = True
Next
End If
Can somebody reccomend how I could amend my code to cater for multiple dropdowns with similar names ID's for instance the category dropdown is called drpMainCategory and the subcategory is called drpMainSubCategory. I want to name the others
drpMainCategory1, drpMainCategory2, drpMainCategory3, drpMainCategory4, drpMainCategory5
drpMainSubCategory1, drpMainSubCategory2, drpMainSubCategory3, drpMainSubCategory4, drpMainSubCategory5
I will also have to change the structure of my database so that the tables show the dropdown ID of the subcategory but for now I just want to know how to loop through the dropdown elements.
Thanks