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 / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

How get syntax right for this HTML written in code?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ronald S. Cook - 12 Oct 2007 04:53 GMT
How can I write this code so that it will appear as just "Click here" but
encoded with the link information?

strFile = "Click here";
row["Link"] = "<a href="http://www.ibm.com>" + strFile + "</a>";

Thanks!
Peter Duniho - 12 Oct 2007 08:30 GMT
> How can I write this code so that it will appear as just "Click here" but
> encoded with the link information?
>
> strFile = "Click here";
> row["Link"] = "<a href="http://www.ibm.com>" + strFile + "</a>";

What are you having trouble with?

If you want a string with double-quotes in it, you need to "escape" the
double-quotes by preceding the double-quote character with a backslash.

Otherwise, it should be just like writing the regular HTML as you'd see
it in a web page.

Pete
Enkidu - 12 Oct 2007 10:46 GMT
> How can I write this code so that it will appear as just "Click here" but
> encoded with the link information?
[quoted text clipped - 3 lines]
>
> Thanks!

Try

row["Link"] = "<a href=\"http://www.ibm.com\">" + strFile + "</a>";

Cheers,

Cliff

Signature

Have you ever noticed that if something is advertised as 'amusing' or
'hilarious', it usually isn't?

Jeff Jarrell - 12 Oct 2007 15:53 GMT
Aside from escaping the quote '   \" '

I find String.Format() can provide an easier to read syntax.

row["Link"] = String.Format("<a
href={0}http://www.ibm.com{0}>{1}","\'",strFile)

> How can I write this code so that it will appear as just "Click here" but
> encoded with the link information?
[quoted text clipped - 3 lines]
>
> Thanks!

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.