473,385 Members | 1,919 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,385 software developers and data experts.

Referencing web page in separate code file

I have a standard aspx page format that I replicate in many places on my site. That page has a lengthy page_load section, that I'd love to stick in a single code file (e.g. MyFunctions.vb). I know how to do this for simple functions such where I pass in and get back string parameters etc, but the code I want to stick in that code file includes commands to modify controls on the aspx page (e.g. label.text = "hello"). Can anyone tell me how to pass the name of the aspx page from the aspx page to the code file, and reference/modify controls on the aspx page from the code file? The scenario is:

Page1.aspx - page_load includes MyFunctions.InitializeLabels("page1.aspx")
Page2.aspx - page_load includes MyFunctions.InitializeLabels("page2.aspx")
MyFunctions.vb -
class MyFunctions
public shared function InitializeLabels
...commands like CallingPage.Label1.text = "Hello, World"

Nov 18 '05 #1
1 1517
Hi,

a) consider using OO approch and create your own Page base class. this
class can implement your code and all derived Pages will use your code.

b) HttpContext.Current.Handler reference to the request IhhtpHandler
which is the calling Page.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

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

Similar topics

2
by: Torrance S. | last post by:
Hi, I have a class in an assembly that references a value in web.config like this: <appSettings> <add key="mykey" value="myvalue"/> </appSettings> string temp =...
12
by: Mark Broadbent | last post by:
Hi guys, just going through remoting at the moment and a couple of questions relating to .net in general has surfaced. Firstly I have seen in the designer that for the namespace and many of its...
1
by: Sasha Nikolic | last post by:
I have defined a managed class ( __gc ) and a unmanaged ( __nogc ) in a separate files (but in the same vc++ dotnet project). I have no problem of referencing the unmanaged class from the menaged...
6
by: Mikey_Doc | last post by:
Hi We are running cms 2002, Framework 1.0 with Visual studio 2002. We have just upgraded to Framework 1.1 and visual studio 2003. All of our database connection strings are stored within the...
2
by: HankD | last post by:
Hi, I am having a problem with instantiating two custom objects so they DO NOT point to the same memory location. What is happening is that changes I am making to my object1 are changing object2. I...
4
by: steve_barker333 | last post by:
Hi guys! I keep getting the following error reported by VS 2005 in my ASP.NET 2.0 web project: "The type or namespace name 'MainPages_XXX' could not be found (are you missing a using...
0
by: jodman | last post by:
Hi all, I am creating a web application in APS.NET using Microsoft visual web developer. At the moment I have a large VB script that generates a text version of the current date when the page...
1
by: rmcellig | last post by:
This is the code I am using at the moment for my pull down menu. It works great. I was wondering if it is possible to have the pull down menu reference a list file instead of entering each item...
2
by: Andrus | last post by:
I need compile in-memory assembly which references to other in-memory assembly. Compiling second assembly fails with error Line: 0 - Metadata file 'eed7li9m, Version=0.0.0.0, Culture=neutral,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.