PDA

View Full Version : Migrating Include files From ASP to ASP.net


planetscott
05-01-2003, 01:39 AM
Hello,

In programming ASP, I often used "includes" files to
store subroutines and functions used in many pages. I cannot seem to get this model to work in ASP.net. What am I missing?

Example - Does Not Work
File index.aspx
<script runat="server">

DoThis()

</script>
<!--#include file=code.ascx-->

File code.ascx
<script runat="server">

Sub DoThis()
Do some things here
End Sub

</script>

But this works just fine
File index.aspx
<script runat="server">

DoThis()

Sub DoThis()
Do some things here
End Sub

</script>

davidseye
05-17-2003, 08:30 AM
I am not yet an expert in ASP.NET so my response may be wrong, but since the file you are trying to include is an ascx file, it will work as a custom control. Include it in the page that way.

Put this at the top of the aspx page in which you want to include the ascx file (modify to fit your needs)

<%@ Register TagPrefix="jdp" TagName="PageHeader" Src="header.ascx" %>

Then in the body of the page, put something like this:

<jdp:PageHeader runat="server" />

See how that works for you.