Reputation:
I'm trying to get the text within the ASP Hyperlink control to NOT wrap when it is placed within a html table as below:
<table style="width: 320px" class="noLines">
<tr><td style="width: 300px"> <asp:HyperLink Target="_self" ID="frmSuggest" Text ="Click Click Click Click Click" Visible="false" runat="server"></asp:HyperLink>
</td></tr>
<table>
I have tried adding a width property to the HyperLink and this does the trick unfortunatley it shifts all the other controls within this table by this width as well!
Upvotes: 1
Views: 3045
Reputation: 2341
i don't know if i understand you right, but here is a VB function that will trim a string without cutting words, you can convert it to c# here http://converter.telerik.com/
Function neatTrim( strToTrim, desiredLength ) '==== strToTrim = trim( strToTrim )
if len( strToTrim ) < desiredLength then
neatTrim = strToTrim
exit function
else
if inStrRev( strToTrim, " ", desiredLength ) = 0 then
strToTrim = left( strToTrim, desiredLength - 1 ) & "…"
else
strToTrim = left( strToTrim, inStrRev( strToTrim, " ", desiredLength + 1 ) -1 ) & "…" 'no carriage return here
end if
end if
neatTrim = trim( strToTrim )
End Function
Upvotes: 0
Reputation: 48088
in addition to El Greco's answer, nobr tag is another option
<asp:HyperLink Target="_self" ID="frmSuggest" Visible="false" runat="server">
<nobr>Click Click Click Click Click</nobr>
</asp:HyperLink>
Upvotes: 0
Reputation: 4959
<td style="white-space:nowrap;">
<!-- You link here -->
</td>
Overrides though the width setting.
Upvotes: 2