Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

hyphen in hyperlink causing unwanted break in text line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe Stateson - 24 Oct 2007 23:39 GMT
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 '-'?
Göran Andersson - 25 Oct 2007 00:30 GMT
> 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.

Signature

Göran Andersson
_____
http://www.guffa.com

Nathan Sokalski - 25 Oct 2007 00:55 GMT
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.
Signature

Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.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.
[quoted text clipped - 18 lines]
> Maybe there is a better way that does not involve interpreting any
> characters such as '-'?
Joe Stateson - 25 Oct 2007 14:42 GMT
> My recommendation would be to use the CSS property white-space, as in the
> following:
[quoted text clipped - 11 lines]
> property it is prevented from wrapping. You can test this out by removing
> the white-space:nowrap; from the style attribute. Hopefully this helps.

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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.