Samjus
Samjus

Reputation: 675

ASPX If statement not loading my content

So I have something like this:

<%If (Request.Url.ToString = "default.aspx") Then %>
        <li><a href="url">Link</a></li>
        <li><a href="url">Link</a></li>
    <%ElseIf (Request.Url.ToString = "anotherdefault.aspx") Then %>
        <li><a href="url">Link</a></li>
        <li><a href="url">Link</a></li>

But for some odd reason it isn't bringing up the links for that certain URL. But when I put a breakpoint on my vb page it works. Think that the IF statement is causing a css problem?

Upvotes: 0

Views: 348

Answers (2)

Sam Sussman
Sam Sussman

Reputation: 1045

Make sure you have an EndIf. If not try something else for the conditional, like just true or false. I would definitely say that it is no a css problem. The inline code is evaluated before css ever sees the doc.

Upvotes: 1

ja928
ja928

Reputation: 438

The "=" is case sensitive. If you're testing by typing the URL into the browser, you might not be testing exactly what is coming from the app. Try using Request.Url.ToString.ToLower() = "default.aspx"

Upvotes: 3

Related Questions