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

L

lm Jr

<cc:SourceWindow id="SourceWindow1"
FileName="<%=Request.ServerVariables["PATH_INFO"]%>" RunAt="server" >

The above produces the following error:

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

Any idea, what to do here? I am an old ASP programmer.

Thanks for help !

LMJ
 
J

Jon Paal [MSMD]

in your code for loading the page use :

SourceWindow1.FileName = [whatever]
 
J

John Saunders [MVP]

lm Jr said:
<cc:SourceWindow id="SourceWindow1"
FileName="<%=Request.ServerVariables["PATH_INFO"]%>" RunAt="server" >

The above produces the following error:

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

Any idea, what to do here? I am an old ASP programmer.

In your Page_Load method, do this:

SourceWindow1.FileName = Request.ServerVariables["PATH_INFO"]


I strongly suggest you never use the technique you tried above. Substituting
directly into the rendered HTML can cause problems. For example, I've been
fighting today with user controls that do things like this:

<script language="javascript">
function Something()
{
var control = document.getElementById("<%= _someControl.ClientID %>");
}
</script>

This innocent piece of script causes one copy of itself to be created for
each instance on a page of the control containing it. Not a problem if the
script is small and there are few instances, but on one of our pages, each
script block is about 750 lines long, and there are over 10 instances of the
control on the same page. It adds up.

Good luck with ASP.NET. Please feel free to ask for help on these
newsgroups, and please try to learn the .NET way of doing things - there's a
reason why ASP.NET was invented, and that reason is ASP!
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top