L
Laura K
I have a drop down menu which has a list of subcategories and the
initial value is "please choose a Subcategory". When the user chooses a
subcategory they are taken to a new page where the drop down list shows
the selected subcategory in the menu. So far that is working.
The problem is that when the list is showing the subcategory on the
second page there are now two of that item in the list and the initial
item that should be available in the drop down is missing.
In other words in the initial drops down the user has the following
options,.
Choose a subcategory
shoes
boots
slippers
The user chooses boots
Then on the following page which is the boots subcategory the list
looks like this.
boots
boots
slippers
I would love some help. Here is the code:
---------------------------------------------------------------------------------
'The Department for which we are loading the categories
Dim BrandID As String = Request.QueryString("brandID")
Dim CategoryID As String = Request.QueryString("CategoryID")
Dim strSubCategory As String =
Request.QueryString("strSubCategory")
'choosing if it is a brand or category - each pulls from a different
database table
If Not IsPostBack Then
If Not CategoryID Is Nothing Then
list.DataSource = Catalog.GetSubCatsinCats(CategoryID)
list.DataBind()
'lblsubnav.Text = CategoryID
'If there is no subcategory in the querystring then you have the
"Please choose a subcategory" and the initial list. Otherwise you
have the selected item showing
HERE IS THE PROBLEM!
If Not strSubCategory Is Nothing Then
list.SelectedItem.Text = strSubCategory
Else
list.Items.Insert(0, "Please choose a subcategory")
End If
'repeats for brands
ElseIf Not BrandID Is Nothing Then
list.DataSource = Catalog.GetSubCatsInBrands(BrandID)
list.DataBind()
If Not strSubCategory Is Nothing Then
list.SelectedItem.Text = strSubCategory
Else
list.Items.Insert(0, "Please choose a subcategory")
End If
Else
' lblsubnav.Visible = False
list.Visible = False
' label.Visible = False
End If
End If
-----------------------------------------------------------------
initial value is "please choose a Subcategory". When the user chooses a
subcategory they are taken to a new page where the drop down list shows
the selected subcategory in the menu. So far that is working.
The problem is that when the list is showing the subcategory on the
second page there are now two of that item in the list and the initial
item that should be available in the drop down is missing.
In other words in the initial drops down the user has the following
options,.
Choose a subcategory
shoes
boots
slippers
The user chooses boots
Then on the following page which is the boots subcategory the list
looks like this.
boots
boots
slippers
I would love some help. Here is the code:
---------------------------------------------------------------------------------
'The Department for which we are loading the categories
Dim BrandID As String = Request.QueryString("brandID")
Dim CategoryID As String = Request.QueryString("CategoryID")
Dim strSubCategory As String =
Request.QueryString("strSubCategory")
'choosing if it is a brand or category - each pulls from a different
database table
If Not IsPostBack Then
If Not CategoryID Is Nothing Then
list.DataSource = Catalog.GetSubCatsinCats(CategoryID)
list.DataBind()
'lblsubnav.Text = CategoryID
'If there is no subcategory in the querystring then you have the
"Please choose a subcategory" and the initial list. Otherwise you
have the selected item showing
HERE IS THE PROBLEM!
If Not strSubCategory Is Nothing Then
list.SelectedItem.Text = strSubCategory
Else
list.Items.Insert(0, "Please choose a subcategory")
End If
'repeats for brands
ElseIf Not BrandID Is Nothing Then
list.DataSource = Catalog.GetSubCatsInBrands(BrandID)
list.DataBind()
If Not strSubCategory Is Nothing Then
list.SelectedItem.Text = strSubCategory
Else
list.Items.Insert(0, "Please choose a subcategory")
End If
Else
' lblsubnav.Visible = False
list.Visible = False
' label.Visible = False
End If
End If
-----------------------------------------------------------------