473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Server tags cannot contain <% ... %> constructs

Hi,

I've put a appSetting tag into my web.config, but when I try to catch its
value to my Image WebControl occurs the follow error: "Server tags cannot
contain <% ... %> constructs."

on myPage.aspx (Notice the ImageUrl tag):
<asp:Image id="Image1" runat="server"
ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi
stema"]%> />

So, What's wrong with my ImageUrl attribution?
Is there any way to do that?

thanks a lot
Marcos
Nov 18 '05 #1
6 47603
you can set this property programmatically within a server script block:
Image1.ImageUrl =
System.Configuration.ConfigurationSettings.AppSett ings.....
you cannot use <%%> inside a web control as web controls already run at the
server.
sharon.

"Marcos MOS" <ma***********@softway.com.br> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Hi,

I've put a appSetting tag into my web.config, but when I try to catch its
value to my Image WebControl occurs the follow error: "Server tags cannot
contain <% ... %> constructs."

on myPage.aspx (Notice the ImageUrl tag):
<asp:Image id="Image1" runat="server"
ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi stema"]%> />

So, What's wrong with my ImageUrl attribution?
Is there any way to do that?

thanks a lot
Marcos

Nov 18 '05 #2
Thanks... but, I'd like to do it inside my .aspx file...

Isn't it possible?

tanks
Marcos

"Sharon" <ta*******@hotmail.com> escreveu na mensagem
news:Ov**************@TK2MSFTNGP10.phx.gbl...
you can set this property programmatically within a server script block:
Image1.ImageUrl =
System.Configuration.ConfigurationSettings.AppSett ings.....
you cannot use <%%> inside a web control as web controls already run at the server.
sharon.

"Marcos MOS" <ma***********@softway.com.br> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Hi,

I've put a appSetting tag into my web.config, but when I try to catch its value to my Image WebControl occurs the follow error: "Server tags cannot contain <% ... %> constructs."

on myPage.aspx (Notice the ImageUrl tag):
<asp:Image id="Image1" runat="server"

ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi
stema"]%> />

So, What's wrong with my ImageUrl attribution?
Is there any way to do that?

thanks a lot
Marcos


Nov 18 '05 #3
i don't know of any way, and there is no reason to do it inside the html
section.
one of the ideas behind web controls design, is the separation of code from
html.

"Marcos MOS" <ma***********@softway.com.br> wrote in message
news:e0*************@TK2MSFTNGP11.phx.gbl...
Thanks... but, I'd like to do it inside my .aspx file...

Isn't it possible?

tanks
Marcos

"Sharon" <ta*******@hotmail.com> escreveu na mensagem
news:Ov**************@TK2MSFTNGP10.phx.gbl...
you can set this property programmatically within a server script block:
Image1.ImageUrl =
System.Configuration.ConfigurationSettings.AppSett ings.....
you cannot use <%%> inside a web control as web controls already run at

the
server.
sharon.

"Marcos MOS" <ma***********@softway.com.br> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Hi,

I've put a appSetting tag into my web.config, but when I try to catch its value to my Image WebControl occurs the follow error: "Server tags cannot contain <% ... %> constructs."

on myPage.aspx (Notice the ImageUrl tag):
<asp:Image id="Image1" runat="server"

ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi
stema"]%> />

So, What's wrong with my ImageUrl attribution?
Is there any way to do that?

thanks a lot
Marcos



Nov 18 '05 #4
use the binding syntax <%# bindingexpression %>

-- bruce (sqlwork.com)
"Marcos MOS" <ma***********@softway.com.br> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Hi,

I've put a appSetting tag into my web.config, but when I try to catch its
value to my Image WebControl occurs the follow error: "Server tags cannot
contain <% ... %> constructs."

on myPage.aspx (Notice the ImageUrl tag):
<asp:Image id="Image1" runat="server"
ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi stema"]%> />

So, What's wrong with my ImageUrl attribution?
Is there any way to do that?

thanks a lot
Marcos

Nov 18 '05 #5
In your code there are some errors :

The <%= construct can only be used in client script for write some value
from server (like old ASP).
your Image is server side not in client side!!!!

You can use the <%# construct. This is for binding value!
<asp:Image id="Image1" runat="server"
ImageUrl='<%#System.Configuration.ConfigurationSet tings.AppSettings["SrcImgS
istema"]%>' />

this code require a DataBind() method call!!!

Brun
"Marcos MOS" <ma***********@softway.com.br> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Hi,

I've put a appSetting tag into my web.config, but when I try to catch its
value to my Image WebControl occurs the follow error: "Server tags cannot
contain <% ... %> constructs."

on myPage.aspx (Notice the ImageUrl tag):
<asp:Image id="Image1" runat="server"
ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi stema"]%> />

So, What's wrong with my ImageUrl attribution?
Is there any way to do that?

thanks a lot
Marcos

Nov 18 '05 #6
In your code there are some errors :

The <%= construct can only be used in client script for write some value
from server (like old ASP).
your Image is server side not in client side!!!!

You can use the <%# construct. This is for binding value!
<asp:Image id="Image1" runat="server"
ImageUrl='<%#System.Configuration.ConfigurationSet tings.AppSettings["SrcImgS
istema"]%>' />

this code require a DataBind() method call!!!

Brun


"Marcos MOS" <marcos.santos@softway.com.br> wrote in message
news:ulbiAAmIEHA.3240@TK2MSFTNGP12.phx.gbl...[color=blue]
> Hi,
>
> I've put a appSetting tag into my web.config, but when I try to catch its
> value to my Image WebControl occurs the follow error: "Server tags cannot
> contain <% ... %> constructs."
>
> on myPage.aspx (Notice the ImageUrl tag):
> <asp:Image id="Image1" runat="server"
>[/color]
ImageUrl=<%=System.Configuration.ConfigurationSett ings.AppSettings["SrcImgSi[color=blue]
> stema"]%> />
>
> So, What's wrong with my ImageUrl attribution?
> Is there any way to do that?
>
> thanks a lot
> Marcos
>
>[/color]
In ASP.NET 2.0 not only can you refer to appSettings declaratively (without using the DataBinding syntax), which is precisely what you are trying to do here, but you can create an ExpressionBuilder that lets you run arbitrary code declaratively, which is precisely what you tried to do. Check it out here: http://infinitiesloop.blogspot.com/
Apr 27 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: | last post by:
Hello, We upgraded to Windows Small Business Server 2003 It seems that there is something changed with the asp INCLUDE statement. here is my code: <!--#include file="../_includes/common.asp"...
5
by: Marcos MOS | last post by:
Hi, I've put a appSetting tag into my web.config, but when I try to catch its value to my Image WebControl occurs the follow error: "Server tags cannot contain <% ... %> constructs." on...
1
by: Martin Schmid | last post by:
I'm getting a parser error message: Server tags cannot contain <% ... %> constructs... Ok.. so How do I accomplish this: For Each file in Files if ucase(right(file.name,7))<>ucase("_tn.jpg")...
3
by: Julie | last post by:
I've got one that I've spent all to much time on: I have an aspx page that includes the following (code behind is C#): <asp:Imagebutton runat="server" ImageUrl='<%# Application +...
1
by: Neil Zanella | last post by:
Hello, I would like to do the following: <form method="post" action="<%= Request.ServerVariables %>" runat="server"> The reason I would like to do this is twofold:
4
by: michaeltorus | last post by:
Do server Side tags decrease performance ... i.e. Does it make any difference from <% response.write "A" % <% response.write "B" % <% response.write "C" % <% response.write "D" % t
2
by: =?Utf-8?B?Sm9zaCBOaWtsZQ==?= | last post by:
I hope someone can help with this, because it’s driving me crazy. It’s also a little tough to describe what’s happening, but I’ll do my best. I have a class that takes a ProductID and...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.