469,950 Members | 1,640 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

hyphen in hyperlink causing unwanted break in text line

I have a template field that contains filenames that are (or can be) on a
unix system. The hypen (and others) is a valid filename character in unix.
When I display the name of the file I get an unwanted break and the text
wraps at the hyphen.

NavigateUrl bound to Eval("file_name","//acqlib/data/{0:c}") launches the
file just fine since there is nothing wrong with the '-' on the linux system
which is the acqlib server.

But binding "Text" as in
Eval("file_name","{0:c}") causes 3-4 rows to be displayed in the hyperlink
shown in the gridview. I assume this is because the hypen is interpreted as
a line break???

Is there a way to fix this in the IDE using Eval? I managed to get it
working using the RowDataBound callback as in ...

hl = (HyperLink)e.Row.Cells[idFilename].FindControl("hl4filename");
hl.Text = e.Row.Cells[idFilename].Text.ToString()..Replace('-','_')

Maybe there is a better way that does not involve interpreting any
characters such as '-'?

Oct 24 '07 #1
3 3842
Joe Stateson wrote:
But binding "Text" as in
Eval("file_name","{0:c}") causes 3-4 rows to be displayed in the
hyperlink shown in the gridview. I assume this is because the hypen is
interpreted as a line break???
No, it's because the hyphen is interpreted as a hyphen. A line break is
allowed after a hyphen, just as with a space.

--
Göran Andersson
_____
http://www.guffa.com
Oct 24 '07 #2
My recommendation would be to use the CSS property white-space, as in the
following:

<a style="white-space:nowrap;">testing-testing</a>

I tested this in IE (it should work the same in other browsers since it's
CSS, but you never know) by including the following in my HTML file:

<div style="width:10px;"><a
style="white-space:nowrap;">testing-testing</a></div>

Notice that the div has a specified width of 10px, which would normally
cause the text to wrap, but because of the white-space:nowrap; CSS property
it is prevented from wrapping. You can test this out by removing the
white-space:nowrap; from the style attribute. Hopefully this helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Joe Stateson" <js*******@swri.eduwrote in message
news:13*************@corp.supernews.com...
>I have a template field that contains filenames that are (or can be) on a
unix system. The hypen (and others) is a valid filename character in unix.
When I display the name of the file I get an unwanted break and the text
wraps at the hyphen.

NavigateUrl bound to Eval("file_name","//acqlib/data/{0:c}") launches the
file just fine since there is nothing wrong with the '-' on the linux
system which is the acqlib server.

But binding "Text" as in
Eval("file_name","{0:c}") causes 3-4 rows to be displayed in the hyperlink
shown in the gridview. I assume this is because the hypen is interpreted
as a line break???

Is there a way to fix this in the IDE using Eval? I managed to get it
working using the RowDataBound callback as in ...

hl = (HyperLink)e.Row.Cells[idFilename].FindControl("hl4filename");
hl.Text = e.Row.Cells[idFilename].Text.ToString()..Replace('-','_')

Maybe there is a better way that does not involve interpreting any
characters such as '-'?

Oct 25 '07 #3

"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
My recommendation would be to use the CSS property white-space, as in the
following:

<a style="white-space:nowrap;">testing-testing</a>

I tested this in IE (it should work the same in other browsers since it's
CSS, but you never know) by including the following in my HTML file:

<div style="width:10px;"><a
style="white-space:nowrap;">testing-testing</a></div>

Notice that the div has a specified width of 10px, which would normally
cause the text to wrap, but because of the white-space:nowrap; CSS
property it is prevented from wrapping. You can test this out by removing
the white-space:nowrap; from the style attribute. Hopefully this helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Thanks Nathan, that worked when I put it in the style for the hyperlink. I
first tried it on the table that the hyperlinks are in but it had to be
specified on the hyperlink style itself. I did not realize that a dash was
treated the same as white space.


Oct 25 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by MrMike | last post: by
27 posts views Thread by The Bicycling Guitarist | last post: by
22 posts views Thread by stevenkobes | last post: by
1 post views Thread by Mark | last post: by
10 posts views Thread by Tim | last post: by
3 posts views Thread by Dominique | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.