Hey Gang!!
I'm using a masterpage to control the layout and appearence of my site but I'm running into a small hang up. I have an ASP menu that runs horizontal across the top of my master page. When you select a category it takes you to /website/<CategoryName>/Defaults.aspx
On my master page I also have a collection of divs that run vertical on the right side. Within each of these divs is the menu written in basic html for the category selected. By default all divs are set as visible = false. When you select your category the onload event checks the URL string and then I can set the appropriate div as visible. Here is what I am currently doing:
If InStr(UCase((Request.ServerVariables("URL"))), "/SALES/") Then
SalesMenuDiv.Visible =
True
Else
SalesMenuDiv.Visible =
FalseEnd If
What I would lIke to do is something like this but I just can't seem to figure it out and can't find any posts on google. I'm sure there has to be something simple I'm over looking.
For each c as control in me.controls
Dim cTxt as String = c.ID
if inStr(cTxt, "MenuDiv") Then
if inStr(Ucase(URL), "/" & Replace(cTxt, "MenuDiv", "") & "/") Then
c.Visible = True
Else
c.Visible = False
End If
End If
Right now I'm having to write out 10 if then statements and it works but I would rather have just one For Each statement. Can someone point me in the right direction?
Thanks!!!