script code in ASPX page

  • Thread starter Thread starter jw56578
  • Start date Start date
J

jw56578

Why does this work in C# but not VB.net

C#
<img src="<% Response.Write("imageroot");%>images/delivery_number.jpg">
VB.Net
<img src="<% Response.Write("imageroot")%>images/delivery_number.jpg">

in c# the value "imageroot" will be created, in VB.net nothing will be
outputted
 
Works here. Language directive changed ? No compilation error ?

An alternate way to do this would be to use an Asp:Image control. ~ in
ImageUrl allows to refer to the application root...
 
Could it be the semicolon? I wouldn't reccommend the usage of
Response.Write directly in the image tag. Instead, give the image tag an
id, and write "imageroot" from your codebehind. Or use an image control,
like he said.

-Alt
 
the correct syntax is:

C#
<img src="<% ="imageroot"%>images/delivery_number.jpg">
VB.Net
<img src="<% ="imageroot"%>images/delivery_number.jpg">

-- bruce (sqlwork.com)
 

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