Commented Code Not Treated As Commented Code

Discussion in 'ASP .Net' started by Jim Heavey, Dec 2, 2003.

  1. Jim Heavey

    Jim Heavey Guest

    Hello, I thought I was loosing my mind. I had a page which was working
    perfectly fine until I decided to try to add a control to a footer line in
    code. So I took the Validation control which was embedded in my .aspx file
    and moved it to the very bottom of the page and placed the "<!--" prior to
    beginning of the <asp:... and then I placed a "-->" after the closing tag
    of my control. Just want to ensure that I could add it in code first prior
    to completly removing the control.

    Every time I ran, I would get an unhandled exception indicating that the it
    could not find the control referenced in my "ControlToValidate". So I
    commented out the code which was adding the control in code and ran again.
    But again, I would get the same error.

    Then I removed my "Commented" code and it ran just fine.

    Why is ASP trying to do anything with the line which is surrounded by the
    "comment" characters?

    Example:

    <!--
    <asp:.....
    -->
     
    Jim Heavey, Dec 2, 2003
    #1
    1. Advertising

  2. That is client-side commenting, it is ignored with server side code. You
    need to use server-side comments:

    <%-- <asp:label runat="server" /> --%>

    Hope this helps,

    - Oisin

    "Jim Heavey" <> wrote in message
    news:Xns944554D7769D7JimHeaveyhotmailcom@207.46.248.16...
    > Hello, I thought I was loosing my mind. I had a page which was working
    > perfectly fine until I decided to try to add a control to a footer line in
    > code. So I took the Validation control which was embedded in my .aspx

    file
    > and moved it to the very bottom of the page and placed the "<!--" prior to
    > beginning of the <asp:... and then I placed a "-->" after the closing tag
    > of my control. Just want to ensure that I could add it in code first

    prior
    > to completly removing the control.
    >
    > Every time I ran, I would get an unhandled exception indicating that the

    it
    > could not find the control referenced in my "ControlToValidate". So I
    > commented out the code which was adding the control in code and ran again.
    > But again, I would get the same error.
    >
    > Then I removed my "Commented" code and it ran just fine.
    >
    > Why is ASP trying to do anything with the line which is surrounded by the
    > "comment" characters?
    >
    > Example:
    >
    > <!--
    > <asp:.....
    > -->
     
    Oisín Grehan, Dec 2, 2003
    #2
    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. Dmitriy Zakharov
    Replies:
    2
    Views:
    437
    Dmitriy Zakharov
    Jul 30, 2004
  2. Scott J. McCaughrin

    static data-member treated as extern

    Scott J. McCaughrin, Nov 8, 2004, in forum: C++
    Replies:
    2
    Views:
    491
    John Harrison
    Nov 9, 2004
  3. Replies:
    5
    Views:
    251
  4. Eugene
    Replies:
    6
    Views:
    763
    Ken Cox [Microsoft MVP]
    Nov 11, 2004
  5. Richard Lionheart
    Replies:
    3
    Views:
    114
    Richard Lionheart
    Nov 20, 2005
Loading...

Share This Page