views:

75

answers:

1

Hi guys,
wanna ask you for help. I am bit lost with declarative statement in asp.net 2.0.
I want add specific class "selected" or "noselected" for A tag when current path is equal to path I provide. I tried st., but it is not working. The code is below:
<a href="<%# DataBinder.Eval(Container.DataItem, "Url") %>" class="<%# (DataBinder.Eval(Container.DataItem, "Url").ToString().Equals(Request.RawUrl))?"selected":"notselected" %>">linkname</a>

the value of "Url" is "/SubDir/SecondPage.aspx"

I am not sure if short "IF" statment works and if I compare right values of urls. If you see guys something significant, would be great.

Thanks. X.

[EDIT] OK, the code above is completely fine, no need to change it. the problem was in me.Beat me.

+1  A: 

The concept looks fine. You might want to try ToLower() on both the URL string value and the RawUrl.

Rex M
Well it wasnt exactly solution, cause the statment works as you said. The problem was between keybord and screen.Anyway thanks
Xabatcha