ASP .NET and ASP style confusion. Immediate solution required

Discussion in 'ASP .Net' started by =?Utf-8?B?TW9oaXQgR3VwdGE=?=, Oct 18, 2004.

  1. Hi all,

    Consider the following ASP program.


    `````````````
    OLD ASP STYLE
    `````````````

    ~~~~~~~~~~
    header.inc
    ~~~~~~~~~~

    <html>
    <body>
    <table .......>
    <tr>
    <td><%=DEFINED_VAR%></td> <!-- DEFINED VAR WILL BE DEFINED AT THE TOP
    OF EACH PAGE -->
    </tr>
    </table>

    ~~~~~~~~~~
    footer.inc
    ~~~~~~~~~~
    </body>
    </html>


    ~~~~~~~~~~
    index.asp
    ~~~~~~~~~~
    <%@ Language="VB" %>
    <%
    Dim DEFINED_VAR
    DEFINED_VAR = "Print this"
    %>
    <!-- #include file="header.inc"-->
    <!-- #include file="footer.inc"-->




    `````````````
    ..NET STYLE
    `````````````

    ~~~~~~~~~~
    header.ascx
    ~~~~~~~~~~

    <%@ Control language="VB" AutoEventWiredUp=False
    Codebehind="HeaderControl.aspx.vb" %>

    <html>
    <body>
    <table .......>
    <tr>
    <td><%=DEFINED_VAR%></td> <!-- It reports me an error at this point -->
    </tr>
    </table>



    ~~~~~~~~~~
    footer.ascx
    ~~~~~~~~~~

    <%@ Control language="VB" AutoEventWiredUp=False
    Codebehind="FooterControl.aspx.vb" %>

    </body>
    </html>



    ~~~~~~~~~~
    index.aspx
    ~~~~~~~~~~
    <%@ Page Language="VB" Codebehing="Page.aspx.vb" AutoEventWiredUp=false %>
    <%@ Register TagPrefix="Pagination" TagPrefix="Header" src="header.ascx" %>
    <%@ Register TagPrefix="Pagination" TagPrefix="Footer" src="footer.ascx" %>

    <%
    Dim DEFINED_VAR
    DEFINED_VAR = "Print this"
    %>

    <Pagination:Header id="header1" runat=server />
    <Pagination:Footer id="footer1" runat=server />


    Note: What I want to do is to pass the DEFINED_VAR in header.ascx file,
    similar to OLD ASP scenario.

    How can i achieve that in .NET

    Your help is immediately required.
     
    =?Utf-8?B?TW9oaXQgR3VwdGE=?=, Oct 18, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?TW9oaXQgR3VwdGE=?=

    Scott Allen Guest

    Does the value of DEFINED_VAR change on each request or is it more of
    a configuration settings?

    If it is constant, you could make the variable the static member of a
    class (shared member in vb.net).

    Otherwise, you could store a value in the Context.Items collection, it
    is useful to communicate state during the processing of a single
    request.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Sun, 17 Oct 2004 22:13:01 -0700, "Mohit Gupta"
    <> wrote:

    >Hi all,
    >
    > Consider the following ASP program.
    >
    >
    >`````````````
    >OLD ASP STYLE
    >`````````````
    >
    >~~~~~~~~~~
    >header.inc
    >~~~~~~~~~~
    >
    > <html>
    > <body>
    > <table .......>
    > <tr>
    > <td><%=DEFINED_VAR%></td> <!-- DEFINED VAR WILL BE DEFINED AT THE TOP
    >OF EACH PAGE -->
    > </tr>
    > </table>
    >
    >~~~~~~~~~~
    >footer.inc
    >~~~~~~~~~~
    > </body>
    > </html>
    >
    >
    >~~~~~~~~~~
    >index.asp
    >~~~~~~~~~~
    ><%@ Language="VB" %>
    ><%
    >Dim DEFINED_VAR
    >DEFINED_VAR = "Print this"
    >%>
    ><!-- #include file="header.inc"-->
    ><!-- #include file="footer.inc"-->
    >
    >
    >
    >
    >`````````````
    >.NET STYLE
    >`````````````
    >
    >~~~~~~~~~~
    >header.ascx
    >~~~~~~~~~~
    >
    ><%@ Control language="VB" AutoEventWiredUp=False
    >Codebehind="HeaderControl.aspx.vb" %>
    >
    > <html>
    > <body>
    > <table .......>
    > <tr>
    > <td><%=DEFINED_VAR%></td> <!-- It reports me an error at this point -->
    > </tr>
    > </table>
    >
    >
    >
    >~~~~~~~~~~
    >footer.ascx
    >~~~~~~~~~~
    >
    ><%@ Control language="VB" AutoEventWiredUp=False
    >Codebehind="FooterControl.aspx.vb" %>
    >
    > </body>
    > </html>
    >
    >
    >
    >~~~~~~~~~~
    >index.aspx
    >~~~~~~~~~~
    ><%@ Page Language="VB" Codebehing="Page.aspx.vb" AutoEventWiredUp=false %>
    ><%@ Register TagPrefix="Pagination" TagPrefix="Header" src="header.ascx" %>
    ><%@ Register TagPrefix="Pagination" TagPrefix="Footer" src="footer.ascx" %>
    >
    ><%
    >Dim DEFINED_VAR
    >DEFINED_VAR = "Print this"
    >%>
    >
    ><Pagination:Header id="header1" runat=server />
    ><Pagination:Footer id="footer1" runat=server />
    >
    >
    >Note: What I want to do is to pass the DEFINED_VAR in header.ascx file,
    >similar to OLD ASP scenario.
    >
    >How can i achieve that in .NET
    >
    >Your help is immediately required.
    >
     
    Scott Allen, Oct 18, 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. Timo
    Replies:
    2
    Views:
    2,836
  2. Just D.
    Replies:
    0
    Views:
    449
    Just D.
    Mar 10, 2006
  3. dm3281
    Replies:
    2
    Views:
    526
    bruce barker \(sqlwork.com\)
    Oct 13, 2006
  4. Ken Varn
    Replies:
    0
    Views:
    474
    Ken Varn
    Apr 26, 2004
  5. Ann
    Replies:
    3
    Views:
    191
    Thomas 'PointedEars' Lahn
    Jan 3, 2008
Loading...

Share This Page