Watermark in background for Debug build

Discussion in 'ASP .Net' started by David Slinn, Jun 27, 2004.

  1. David Slinn

    David Slinn Guest

    I was wondering what the best way to acheive the following would be:

    What I would like is for the background of every page in my ASP.NET web
    project to contain a soft red GIF containing the word "TEST" when the
    version being viewed has been compiled using the DEBUG build. Once we build
    a release version and place that into production, we obviously want that
    "watermark" to disappear.

    Now, I suppose I could create two cascading style sheets, one containing a
    body - background entry for test, the other without it for production. Is
    this the best method, or is there another way?

    - Dave
     
    David Slinn, Jun 27, 2004
    #1
    1. Advertising

  2. David Slinn

    EijiTek Guest

    If you haven't done so already, you could create a base class for the pages
    in your project and in one of the page events (probably PreRender) you could
    dynamically add a control using a directive

    [C#]
    #if DEBUG
    Page.Controls.Add(new LiteralControl("<img src=\"test.gif\" />"));
    #endif

    [VB.NET]
    #If DEBUG Then
    Page.Controls.Add(new LiteralControl("<img src=""test.gif"" />"))
    #End If

    If there is a specific place you wish to place the image you could use the
    AddAt method of the ControlCollection.

    (I may be a little off on the syntax for VB.NET since I have only been using
    C#)

    "David Slinn" <> wrote in message
    news:%236yh0l$...
    > I was wondering what the best way to acheive the following would be:
    >
    > What I would like is for the background of every page in my ASP.NET web
    > project to contain a soft red GIF containing the word "TEST" when the
    > version being viewed has been compiled using the DEBUG build. Once we

    build
    > a release version and place that into production, we obviously want that
    > "watermark" to disappear.
    >
    > Now, I suppose I could create two cascading style sheets, one containing a
    > body - background entry for test, the other without it for production. Is
    > this the best method, or is there another way?
    >
    > - Dave
    >
    >
     
    EijiTek, Jun 27, 2004
    #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. m3ckon

    Adding a Watermark to an Image

    m3ckon, Aug 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,956
    Ken Cox [Microsoft MVP]
    Aug 5, 2004
  2. j
    Replies:
    1
    Views:
    3,013
    Andrew Thompson
    Nov 18, 2003
  3. surjit
    Replies:
    1
    Views:
    518
    kaeli
    Feb 19, 2004
  4. Terry Murray

    Watermark or Background Image

    Terry Murray, Sep 17, 2003, in forum: HTML
    Replies:
    1
    Views:
    9,094
  5. Zilla
    Replies:
    4
    Views:
    3,825
    Hall Real
    Jul 16, 2010
Loading...

Share This Page