How get syntax right for this HTML written in code?

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

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!
 
Ronald said:
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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top