On the ListView1_ItemDataBound of a list view event, i create the literal.text like so...
<span style="position:relative;">
style="position:relative">
<span id="term1" class="popup">This id="term1" class="popup">This is the answer!</span>
<a href="javascript:void(0);"onMouseover="ShowPop('term1');" onMouseout="HidePop('term1');">Show href="javascript:void(0);"onMouseover="ShowPop('term1')" onMouseout="HidePop('term1')">Show me the answer</a></span>
The problem is that the text is not rendered as it should. On mousing over the literal control the url is
http://localhost:1391/"javascript:void(0);"onMouseover="ShowPop('term1');"
So what is going on here? What am i missing?
UPDATE1: Here is the source from the browser
<span style="position:relative;&开发者_开发百科amp;quot;> <span id="term1" class="popup">This is the answer!</span> <a href="javascript:void(0);" onMouseover="ShowPop('term1');" onMouseout="HidePop('term1');">Show me the answer</a></span>
UPDATE2: And here is the output from the screen
This is the answer Show me the answer
where...
Show me the answer is the hyperlink to http://localhost:1391/"javascript:void(0);"
You are missing a space between the end of the href
attribute and the onMouseOver
attribute.
Update: (following comment)
When hovering over a link, some browsers will show you where the href
attribute points. In this case this would be "javascript:void(0);". Some will append the host URL to this preview, some will not.
Update 2: (following update to answer)
Looks like the framework is HTML Encoding the strings you are using. Make sure you set the Mode
property of the literal control to LiteralMode.PassThrough
.
Update 3: (following some testing)
I tried locally using string with quotes and had no problem. Are you sure you are not HTML encoding before setting the text property, or that it isn't coming in encoded? Try HTML decoding before setting the text property.
精彩评论