Lilluda 5
Lilluda 5

Reputation: 1109

Embedding display expression inside asp.net tag

I have a class that just have defined url constants, let's say it is called Urls. I am trying to access a constant in that class inside of a a LoginStatus tag as follows:

<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect" LogoutPageUrl= <%= Urls.logout %>  CssClass="myButton" /> 

and obviously it isn't working. I know I can hardcode the string inside of the field, but I am trying to avoid that if possible. Thanks for the insight!

Upvotes: 0

Views: 70

Answers (1)

TGH
TGH

Reputation: 39268

Try this

LogoutPageUrl="<%# Urls.logout %>"

The # is used to "bind" values to server side properties whereas the = is the same as a Response.Write() which in this case will just write some text to the markup

Upvotes: 1

Related Questions