Bug in Parsing of <a> Tags?

M

Mark Olbert

Can someone explain why the following tag:

<a href='<%# "abc.aspx" %>'>here to login</a>

renders as:

<a href=' '>here to login</a>

?

The same problem occurs if the "abc.aspx" is replaced by SomeProtectedProperty.ToString().

Is there something special/magical about the href so far as ASPNET2 is concerned?

- Mark
 
G

Guest

Mark,
Your hash ("#") needs to go away.

try this:

<a href='<%= "abc.aspx" %>'>here to login</a>

--Peter
 
S

Shimon Sim

It is not a bug.
you can not use <%# but only for databindings. And syntax would depend on
ASP.NET version.
Shimon.
 
M

Mark Olbert

Your hash ("#") needs to go away.
try this:

<a href='<%= "abc.aspx" %>'>here to login</a>
I don't understand why I can't use the #, which I thought was the databinding syntax, in this situation. I use it all the time for
setting, for example, text properties in asp tags. Does # work only with <asp:...> tags?

- Mark
 
Y

Yuan Ren[MSFT]

Hi Mark,

Thanks for posting!

As Peter and Shimon mentioned, for the current issue, the problem is caused
by that the "expression" in the <% # ... %> is not a data-binding
expression but a literal text. Only the data-binding expression in the <% #
... %> can work fine. If you want to use the literal text, please use the
<% = ... %> instead of. The article as below is the definition about the
"Data-Binding Expression Syntax" for your reference:
http://msdn2.microsoft.com/en-us/library/ms178366.aspx

I appreciate your understanding and hope the information will be helpful!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top