can't write <% # in VS.NET

  • Thread starter Thread starter nakhi
  • Start date Start date
N

nakhi

Hi,
what I want to do is simple, output a image whose URL is composed from a
field from a database.

the picture is shown in a Datagrid.

<ItemTemplate>
<img src="<%# databinder.eval(container.dataitem,"id")%>.jpg">
</ItemTemplate>

I am using VS.NET, the problem is it doesn't allow using <%, or u can not
switch to design mode after u write in HTML mode.

But I can't do that with Property dialog of the datagrid object in VS.NET,
can anybody tell me how could I do that in VS.NET design window?

Thanx
Nakhi
 
use this instead
<img src='<%# databinder.eval(container.dataitem,"id")%>.jpg'>

pls note the single quote.
 
Please get back to us whether the change to double quote works
Can someone also explain why is it changing to double quote works and not
single quotes

Cheers

J
 
Double double quotes don't work because it would be a string within a
string. This is something the parser should deal with but doesn't. I think
this does work at runtime in most cases, but at designtime VS's visual
editor can't deal with it because it's essentially nested strings.

+++ Rick --

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
 
Back
Top