tags:

views:

32

answers:

1

Hello,

I've been tryin to find an example of the syntax for getting an html 'title' for a string when using Html.Encode(). I want to display the full name in the mouseover title, if it's too long.

Is there a way to do this without wrapping the string in a < span >, i.e.

 <span title = "<%=Html.Encode(model.Name) %>">   //displays the full name on mouseover
 <%=Html.Encode(model.Name.Substring(0, 10))%>... //displays the name up to a max length
 </span>

Or should I just do it this way?

Thanks!

+1  A: 

Without a containing element, where are you going to hang your title?

So, yes, you should wrap it in an inline element like span

Sky Sanders
Ah. Ok, thanks! No wonder I couldn't find an example then :) I will leave it as is
Kai