Includes and codebehind page

G

Guest

I'm a begginer at ASP.NET having developed for several years in ASP and
VBScript.

I am developing a website where I'm componetazing the header, content
section and the footer. Each secion is a different page.

My codes looks like something like this

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb"
Inherits="LDOL._default" %>
<html>
<!--#include file="header.aspx"-->
default page content here...
<!--#include file="footer.aspx"-->
</html>

My dilema comes when I have different functions in the header.vb page (such
as getting metatags from a db) that cannot be seen because the default.aspx
page looks for the function in the default.vb page instead. It returns an
error "Function not declared". I've tried to find a way where I can have all
my common functions in a centrailzed place (like the global.asax) but have
not been successfull. Am I trying to make ASP.NET do something that was a
shortcoming of ASP? That is what is seems to me...
 
A

alan.washington

There are probably several ways to do what you are try to dohere. The first that comes to mind and probably the cleanest,is just create a seperate class project/files that contain allthe functions that you want to use. For example, in VisualStudio create a ASP.Net application in a solution. Then Addanother project to that solution that is a Class Library. Allyour common functions can be placed in here and used throughoutyour application by referencing the library. To reference itsimply add a reference by right cliking on the Reference sectionin the ASP.Net web application, then click on the tab that reads"Projects" and the reference will be added.

Hope this helps.

Alan Washington
http://www.aewnet.com
I'm a begginer at ASP.NET having developed for several years inASP and
VBScript.

I am developing a website where I'm componetazing the header,content
section and the footer. Each secion is a different page.

My codes looks like something like this

<%@ Page Language="vb" AutoEventWireup="false"Codebehind="default.aspx.vb"
Inherits="LDOL._default" %>
<html>
<!--#include file="header.aspx"-->
default page content here...
<!--#include file="footer.aspx"-->
</html>

My dilema comes when I have different functions in theheader.vb page (such
as getting metatags from a db) that cannot be seen because thedefault.aspx
page looks for the function in the default.vb page instead. Itreturns an
error "Function not declared". I've tried to find a way whereI can have all
my common functions in a centrailzed place (like theglobal.asax) but have
not been successfull. Am I trying to make ASP.NET do somethingthat was a
shortcoming of ASP? That is what is seems to me...
User submitted from AEWNET (http://www.aewnet.com/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top