473,505 Members | 14,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a class object in my aspx page without using codebehind

Hi, can anyone please solve this problem?

My main page is :WebForm2.aspx
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm2.aspx.vb" Inherits="Transactions.WebForm2"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="ReportComponents" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
....
....
....
<script src="scripts.js"></script>
<script runat="server">

Protected _styleSheet As String

Private _IdNumber As String = "IdNumber"

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
BindList()
End If

Private Sub BindList()
ClientList.DataSource = DrillDownReport.GetClients()
ClientList.DataBind()
End Sub
....
...
....
My Class is : DrillDownReport.vb
Namespace ReportComponents
Public Class DrillDownReport
Private _IdNumber As String
Nov 19 '05 #1
2 1963
Gerald:

That's because you have not instantiated your object yet.

Try this:

Private myDrillDownReport as New DrillDownReport
Protected _styleSheet As String
Private _IdNumber As String = "IdNumber"

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
BindList()
End If
End Sub

Private Sub BindList()
ClientList.DataSource = myDrillDownReport.GetClients()
ClientList.DataBind()
End Sub

Venki

"Gerald" wrote:
Hi, can anyone please solve this problem?

My main page is :WebForm2.aspx
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm2.aspx.vb" Inherits="Transactions.WebForm2"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="ReportComponents" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
....
....
....
<script src="scripts.js"></script>
<script runat="server">

Protected _styleSheet As String

Private _IdNumber As String = "IdNumber"

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
BindList()
End If

Private Sub BindList()
ClientList.DataSource = DrillDownReport.GetClients()
ClientList.DataBind()
End Sub
....
...
....
My Class is : DrillDownReport.vb
Namespace ReportComponents
Public Class DrillDownReport
Private _IdNumber As String
.
.
Public Shared Function GetClients() As ArrayList
.
.
End Function
End Class
End Namespace

THIS IS MY PROBLEM:

When the main page loads, and gets to line which says:
" ClientList.DataSource = DrillDownReport.GetClients()"

It gives this error " Compiler Error Message: BC30451: Name
'DrillDownReport' is not declared."

Can anyone give me a helping hand? Please i use codeinline for now i
can't cange to codebehind due to the nature of this particular job.

Let your answers please correspond to codeinline:

Thanks

Gerald

Nov 19 '05 #2
Hi Wenk,

I did exactly as you said and it gave this error:
Compiler Error Message: BC30002: Type 'DrillDownReport' is not defined

Nov 19 '05 #3

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

Similar topics

4
7000
by: BH | last post by:
I'm looking at the source code of the ASP.NET forum sample application. It has the "code-behind" classes compiled into a separate DLL, totally separated from the aspx/ascx files. Adding the class...
0
297
by: Bennett Haselton | last post by:
I've noticed that if you enter the following code in the codebehind page for an .aspx page, it won't compile because the call to Trace.Write() is not valid except in methods of a class derived from...
2
2343
by: Christopher Ambler | last post by:
I'm wondering if there's a solution here - I have an ASPX page with a sole purpose of scaling an image. The ASPX page contains a single line with the codebehind tag, and the .cs file contains...
5
1812
by: ozie | last post by:
Hi , I am new to ASP.NET. I was reading about Page class in one of the ASP.NET books and am confused with the way the Page class is actually implemented.What is didnt understand in when is this...
5
3143
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access...
4
1563
by: Wayne Wengert | last post by:
I am trying to work through an ASP.NET book and in one example you build a Class and then call a method from that class in an ASPX page. I put the class file ("quote.dll") in the bin directory and...
16
2627
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
15
2392
by: Joe Fallon | last post by:
I would like to know how you can figure out how much memory a given instance of a class is using. For example, if I load a collection class with 10 items it might use 1KB, and if I load it with...
2
1196
by: Adrian | last post by:
Hi all of the PC that will have access to the ASPX page have a COM object installed and using Codebehind I add a COM reference to it and I can call it like this: View.ViewSrv vs = new...
0
7216
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
7303
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,...
1
7018
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...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.