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

Discussion in 'ASP .Net' started by lm Jr, May 5, 2007.

  1. lm Jr

    lm Jr Guest

    <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
     
    lm Jr, May 5, 2007
    #1
    1. Advertising

  2. in your code for loading the page use :

    SourceWindow1.FileName = [whatever]



    "lm Jr" <> wrote in message news:O%...
    > <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
    >
     
    Jon Paal [MSMD], May 5, 2007
    #2
    1. Advertising

  3. "lm Jr" <> wrote in message
    news:O%...
    > <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!
    --
    John Saunders [MVP]
     
    John Saunders [MVP], May 5, 2007
    #3
  4. lm Jr

    lm Jr Guest

    Thanks for your suggestions. That was really helpful !!

    LM J
     
    lm Jr, May 5, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marcos MOS
    Replies:
    5
    Views:
    15,888
    Bruno Sirianni
    Apr 15, 2004
  2. Neil Zanella
    Replies:
    1
    Views:
    5,052
    Philip Q [MVP]
    Jan 12, 2005
  3. AAaron123
    Replies:
    5
    Views:
    964
    AAaron123
    Sep 28, 2009
  4. Roger Pack
    Replies:
    3
    Views:
    183
    Roger Pack
    Sep 28, 2010
  5. Jason Carlton
    Replies:
    11
    Views:
    264
    Dr J R Stockton
    Dec 8, 2009
Loading...

Share This Page