#include files?

Discussion in 'ASP .Net' started by Mike Laskie, Aug 27, 2003.

  1. Mike Laskie

    Mike Laskie Guest

    Hi,

    Am porting an ASP application to ASP.NET, server side C# and not seeing
    anything on how to handle something like the following...

    <!-- #include file = "myfile.inc" -->


    Am not have much luck with ...
    /// <include file='myfile.inc' path='/inc' >

    Any ideas? We use a few include files.

    Thanks,

    - Mike
    Mike Laskie, Aug 27, 2003
    #1
    1. Advertising

  2. Mike Laskie

    Mark Kamoski Guest

    Mike--

    Check out UserControls.

    They are a great way to simulate the use of "include files" in this
    post-ASPClassic era.

    They are easy to use, and VERY powerful.

    HTH.

    --Mark


    "Mike Laskie" <> wrote in message
    news:...
    Hi,

    Am porting an ASP application to ASP.NET, server side C# and not seeing
    anything on how to handle something like the following...

    <!-- #include file = "myfile.inc" -->


    Am not have much luck with ...
    /// <include file='myfile.inc' path='/inc' >

    Any ideas? We use a few include files.

    Thanks,

    - Mike
    Mark Kamoski, Aug 27, 2003
    #2
    1. Advertising

  3. Mike Laskie

    DKrapohl Guest

    As a boost into User Controls (which is what you are talking about),
    here's the following microwave primer:

    Create a new user control that has the resuable items you want (a
    header in this example) and call it header.ascx. Put an image in it
    for now.

    Under the 'page language' tag in the aspx page you want to reuse the
    file in, put the following:

    <%@ Register TagPrefix="YourHeader" TagName="TheHead"
    Src="header.ascx"%>

    Then in the place you want to see it on the page (in a table row in
    this example) you'd say:

    <tr>
    <td>
    <YourHeader:TheHead id="MyTag" runat="server"
    name="MyTag"></YourHeader:TheHead>
    </td>
    </tr>

    Compile and view it. Your image will be properly included.


    Don Krapohl
    http://www.tranquillitas.com
    Website quality assurance testing
    DKrapohl, Aug 28, 2003
    #3
  4. Mike Laskie

    DKrapohl Guest

    You can create a class and then write the 'Imports MyClass' line at
    the top of the page (after the page directive) and put all of your
    constants in it. This is probably a more elegant solution in line
    with your question. But in the end, I believe that you can still use
    the old style #include statement. A benefit of using a class right
    off the top of my head is that you have intellisense which should make
    MSFT wealthy if that's all they ever did for us.

    Please let me know if I am incorrect in my statement regarding the
    classic #includes.

    Don Krapohl
    http://www.tranquillitas.com
    Website quality assurance testing
    DKrapohl, Aug 30, 2003
    #4
  5. Mike Laskie

    Mike Laskie Guest

    And is at the top of mine, yep, nice feature.

    What I find is the following preprocessors...
    #if
    #else
    #elif
    #endif
    #define
    #undef
    #warning
    #error
    #line
    #region
    #endregion
    I remember reading about this and seeing an example, just haven't been able to recall. At runtime/debugtime the included code (sheesh I got to stop calling it that) is inserted into the body and seamlessly present to step through.
    Mike Laskie, Sep 2, 2003
    #5
    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. Danny Anderson
    Replies:
    5
    Views:
    487
    Victor Bazarov
    Aug 15, 2003
  2. Rolf Magnus
    Replies:
    2
    Views:
    591
    Karl Heinz Buchegger
    Nov 28, 2003
  3. Elie Nader
    Replies:
    1
    Views:
    626
  4. Aguilar, James
    Replies:
    2
    Views:
    676
    Aguilar, James
    Jul 16, 2004
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    889
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page