473,324 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

ASP .NET and ASP style confusion. Immediate solution required

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.
Nov 18 '05 #1
1 1022
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"
<Mo********@discussions.microsoft.com> 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.


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kylotan | last post by:
I thought mod_python would be the answer to my CGI performance issue, but I can't seem to make much sense out of it. All the examples are too trivial to be of much use. Given that I have an...
1
by: xtra | last post by:
Hi Folk I have written a module that allows you to type a bunch of commands in the immediate window, for quick access to information when you are creating VB code. Here it is, it may be helpful...
1
by: Flavian Mwasi | last post by:
I'm a novice programmer just beginning to learn the new C# language. I'm a bit confused about the way Inheritance and Interfaces are constructed in C#. The following examples may help clarify...
8
by: Z D | last post by:
Hello, I'm having a strange problem that is probably due to my lack of understanding of how threading & COM Interop works in a WinForms.NET application. Here's the situation: I have a 3rd...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
52
by: Sergey Zuyev | last post by:
Hello All I work at software company and we are having a really big discussion about coding styles and it seems that more people prefer statement 1 to statement2 , which was a big surprise to...
8
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must...
1
by: =?Utf-8?B?SmltSGVhdmV5?= | last post by:
If I create a <divand specify that I want the font-size to be 1.2em for instance, why do the <asp:controls not follow this rule if they are contained within the <divstatement? How/what do I need...
8
by: vaib | last post by:
hi all , It really seems that C never ceases to amaze . All this time i've been doing C and i thought i was quite adept at it but i was wrong . So without wasting any more time , here's the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.