By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,611 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,611 IT Pros & Developers. It's quick & easy.

Calling a class object in my aspx page without using codebehind

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.