can't write <% # in VS.NET

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
 
D

Dai Hao

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

pls note the single quote.
 
J

James Zhuo

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
 
R

Rick Strahl [MVP]

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top