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

How to use Page_Load event in a Class

Hello,

I have created a simple Class:

Public Class DataConnection : Inherits Page
Public Sub Page_Load(Sender As Object, E As EventArgs)
Response.Write("Hello Steven")
End Sub
End Class

The question I have is, how does the Page_Load event in the Class act when
it is being pulled into an aspx page?

<%@ Page Inherits="DataConnection" src="cnnData.vb" Language="VB"
Explicit="True" Debug="True"%>

--
Thanks in advance,

Steven

Nov 18 '05 #1
2 967
According to your code, the Page you're creating IS the DataConnection
class.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Steven K" <sk****@troop.com> wrote in message
news:eJ*************@TK2MSFTNGP10.phx.gbl...
Hello,

I have created a simple Class:

Public Class DataConnection : Inherits Page
Public Sub Page_Load(Sender As Object, E As EventArgs)
Response.Write("Hello Steven")
End Sub
End Class

The question I have is, how does the Page_Load event in the Class act when
it is being pulled into an aspx page?

<%@ Page Inherits="DataConnection" src="cnnData.vb" Language="VB"
Explicit="True" Debug="True"%>

--
Thanks in advance,

Steven

Nov 18 '05 #2
Sorry for the vagueness. The class DataConnection is in a file named
cnnData.vb and the aspx file that is calling it is myfile.aspx. What I'm
trying to ask is why don't I get the text "Hello Steven" when myfile.aspx is
loaded since it is calling cnnData.vb? Also, is it ok to have a Page_Load
sub in both files?

--
Thanks in advance,

Steven
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...
According to your code, the Page you're creating IS the DataConnection
class.
"Steven K" <sk****@troop.com> wrote in message
news:eJ*************@TK2MSFTNGP10.phx.gbl...
Hello,

I have created a simple Class:

Public Class DataConnection : Inherits Page
Public Sub Page_Load(Sender As Object, E As EventArgs)
Response.Write("Hello Steven")
End Sub
End Class

The question I have is, how does the Page_Load event in the Class act when it is being pulled into an aspx page?

<%@ Page Inherits="DataConnection" src="cnnData.vb" Language="VB"
Explicit="True" Debug="True"%>

--
Thanks in advance,

Steven


Nov 18 '05 #3

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

Similar topics

13
by: z. f. | last post by:
Hi, i have a class that is derived from System.Web.UI.Page, and this is the class i use in my application as PageBase. all other page classes are deriverd from my PageBase instead of the...
3
by: Christian | last post by:
hi, what is the difference between the Page_Load() and OnLoad() event handlers. do they originate from a different point ?
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
2
by: Dave | last post by:
Hi, this is a follow-up to an earlier question but I really haven't found a definitive answer in my search If I have a Base and Derived webform, I've found that the dervived Page_Load event...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.