The variable name in your example is included inside quotes and will thus be
interpreted as a string literal, NOT a variable name. Try this:
objCell.Text = string.Format("<img src=\"{0}\">", imageLocation.ToString());
Of course, if imageLocation is already a string you can omit ToString().
I hope this helps.
--
Kai Brinkmann [MSFT]
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"jbatty" <ja***@batty.com> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
I am trying to display an image on my page by using "img src= hyperlink".
the hyperlink is stored in a c# variable. but i seem to have the syntax
mixed up.
This passing the image directly works e.g.
objCell.Text = "<img src=\"image.gif\">";
but using a variable does not seen to work.
String imageLocation="image.gif";
objCell.Text = "<img src=imageLocation >";
i am having to use a variable because the statement will be used within a
loop
Thanks