R
Roger Helliwell
Hi Everyone,
I have a DataGrid which contains various columns, one of which is an
image which comes from the data source. I'd like to bind the HTML
'alt' setting as well with text from the data source. A problem occurs
when the text in the data source has a single quote however.
For example, if the text in the data source is "John Doe's tractor",
only "John Doe" appears in the IMG tag. (The single quote terminated
the string.)
My code is below. I've played around with rearranging the quotes, but
no success. Does anyone know a way around this? (Incidentally, I even
tried changing "John Doe's" in my data source to John Doe's but
the result is the same.)
<ItemTemplate>
<IMG alt='<%# DataBinder.Eval(Container.DataItem, "Description")%>'
src='<%# "thumbs/" + DataBinder.Eval(Container.DataItem,
"Snapshot")%>' width="100px">
</ItemTemplate>
Thanks,
Roger
I have a DataGrid which contains various columns, one of which is an
image which comes from the data source. I'd like to bind the HTML
'alt' setting as well with text from the data source. A problem occurs
when the text in the data source has a single quote however.
For example, if the text in the data source is "John Doe's tractor",
only "John Doe" appears in the IMG tag. (The single quote terminated
the string.)
My code is below. I've played around with rearranging the quotes, but
no success. Does anyone know a way around this? (Incidentally, I even
tried changing "John Doe's" in my data source to John Doe's but
the result is the same.)
<ItemTemplate>
<IMG alt='<%# DataBinder.Eval(Container.DataItem, "Description")%>'
src='<%# "thumbs/" + DataBinder.Eval(Container.DataItem,
"Snapshot")%>' width="100px">
</ItemTemplate>
Thanks,
Roger