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

How to return a collection from a class to a aspx page

I have a .net aspx page MyPage.aspx (client side) with code behind
MyPage.aspx.vb (server side).

I use the Page_Load event in MyPage.aspx.vb to load data into a multiteir
class based collection.

MyCollection(sYear).cMonths(sMonth).cDays(sDay).cE vents(sID).EventText

My problem arrives when I try to access this collection from the page
(MyPage.aspx).

On the page's server side I have:
MyPage.aspx.vb <<<
Public Class EventsCal
Inherits System.Web.UI.Page
Private moColYears As colYears

Private Sub Page_Load(....
(Code to load data into class...)

end sub

Public Function AbvCollection() As colYears
Return moColYears
End Function

Public Function AbvTest() As Integer
Return 1
End Function
---------------------------
On the page's client side I have: MyPage.aspx <<<


<SCRIPT language="vbscript" id="clientEventHandlersVBS">
<!--

Private oColYears

Sub window_onload
set oColYears = <%= AbvCollection() %>
...
---------------------------
---------------------------
colYears is initial level of my class collection structure
colYears.vb
oYear.vb
colMonths.vb
oMonths.vb
etc.

If I set set oColYears = <%= AbvTest() %> it works just fine.
However, when I
set oColYears = <%= AbvCollection() %>

I receive an error of

....runtime error: Object required: 'ELFsearchClient"

ELFsearchClient is the app name.

I have tried this sixteen different ways. There must be a way to access
the class collection data.

What am I doing wrong??????

Thank you for all help!!!
Nov 19 '05 #1
2 1619
kermit wrote:
I have a .net aspx page MyPage.aspx (client side) with code behind
MyPage.aspx.vb (server side).

I use the Page_Load event in MyPage.aspx.vb to load data into a
multiteir class based collection.

MyCollection(sYear).cMonths(sMonth).cDays(sDay).cE vents(sID).EventText

My problem arrives when I try to access this collection from the
page (MyPage.aspx).

On the page's server side I have:
MyPage.aspx.vb <<<
Public Class EventsCal
Inherits System.Web.UI.Page
Private moColYears As colYears

Private Sub Page_Load(....
(Code to load data into class...)

end sub

Public Function AbvCollection() As colYears
Return moColYears
End Function

Public Function AbvTest() As Integer
Return 1
End Function
---------------------------
On the page's client side I have: MyPage.aspx <<<


<SCRIPT language="vbscript" id="clientEventHandlersVBS">
<!--

Private oColYears

Sub window_onload
set oColYears = <%= AbvCollection() %>
...
---------------------------
---------------------------
colYears is initial level of my class collection structure
colYears.vb
oYear.vb
colMonths.vb
oMonths.vb
etc.

If I set set oColYears = <%= AbvTest() %> it works just fine.
However, when I
set oColYears = <%= AbvCollection() %>

I receive an error of

...runtime error: Object required: 'ELFsearchClient"

ELFsearchClient is the app name.

I have tried this sixteen different ways. There must be a way to
access the class collection data.

What am I doing wrong??????

Thank you for all help!!!


You are trying to generate client-side vbscript. When you use AbvCollection()
in this way, some string representation is used. I don't think that vbscript
will understand that.
Take a look at the generated vbscript (view source in the browser). I think
you will see something like
set oColYears = <the classname of the collection>
You will need to find a way to translate the contents of the collection into
something that client-side vbscript can work with. (sorry, I can't help you
with that)

Remember: client-side code and server-side code do *not* run at the same
time! First the server-side code runs, this generates a text file (containing html
and script) which gets interpreted by the browser, that in turn will run
any client side code there.

Hans Kesting
Nov 19 '05 #2


"Hans Kesting" wrote:
kermit wrote:
I have a .net aspx page MyPage.aspx (client side) with code behind
MyPage.aspx.vb (server side).

I use the Page_Load event in MyPage.aspx.vb to load data into a
multiteir class based collection.

MyCollection(sYear).cMonths(sMonth).cDays(sDay).cE vents(sID).EventText

My problem arrives when I try to access this collection from the
page (MyPage.aspx).

On the page's server side I have:
> MyPage.aspx.vb <<<
Public Class EventsCal
Inherits System.Web.UI.Page
Private moColYears As colYears

Private Sub Page_Load(....
(Code to load data into class...)

end sub

Public Function AbvCollection() As colYears
Return moColYears
End Function

Public Function AbvTest() As Integer
Return 1
End Function
---------------------------
On the page's client side I have:
> MyPage.aspx <<<


<SCRIPT language="vbscript" id="clientEventHandlersVBS">
<!--

Private oColYears

Sub window_onload
set oColYears = <%= AbvCollection() %>
...
---------------------------
---------------------------
colYears is initial level of my class collection structure
colYears.vb
oYear.vb
colMonths.vb
oMonths.vb
etc.

If I set set oColYears = <%= AbvTest() %> it works just fine.
However, when I
set oColYears = <%= AbvCollection() %>

I receive an error of

...runtime error: Object required: 'ELFsearchClient"

ELFsearchClient is the app name.

I have tried this sixteen different ways. There must be a way to
access the class collection data.

What am I doing wrong??????

Thank you for all help!!!


You are trying to generate client-side vbscript. When you use AbvCollection()
in this way, some string representation is used. I don't think that vbscript
will understand that.
Take a look at the generated vbscript (view source in the browser). I think
you will see something like
set oColYears = <the classname of the collection>
You will need to find a way to translate the contents of the collection into
something that client-side vbscript can work with. (sorry, I can't help you
with that)

Remember: client-side code and server-side code do *not* run at the same
time! First the server-side code runs, this generates a text file (containing html
and script) which gets interpreted by the browser, that in turn will run
any client side code there.

Hans Kesting

Hans,
You are correct it translates it into: ELFsearchClient.colYears
which is my applications name . collections class name. I keep
getting tangled up in trying to pass data from the server side to the
client side. I thought using a class would maybe allow me to do that.
But I guess if I think about it, the class is entirely server side. I
really want an indexed collection type on the client side. But have
not come up with anything that works yet. As the user takes certain
actions I want to reload certain controls with new data based on selections
and did not want to have to get a new dataset each time. These are
client side only controls, can't set them to runon server.

Thank you for your observations.

Nov 19 '05 #3

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

Similar topics

10
by: Kathy Burke | last post by:
HI. in asp.net app, I have an xmlDocument that I transform to the client html. Using xsl I create a few textboxes to capture user input. Each of these are related to <data> elements in the xmlDoc....
1
by: Jeff S | last post by:
I'm storing a list of widgets in a database. The list changes infrequently (twice per week at most), and is relatively short (200 items at most, with very little detail per item). A small subset of...
3
by: TJS | last post by:
from a code class, a] how does one dimension a collection and then b] after it is created, reassign it in the page ? I'm getting only errors on line of code in the page....
6
by: Whoever | last post by:
Here's what I have A custom collection: public class aUser { public string UserName { get {...} set {...} } public class UserList : System.Collection.CollectionBase { public void Add(aUser...
2
by: kermit | last post by:
I have an .net aspx page MyPage.aspx (client side), with code behind MyPage.aspx.vb (server side) I use the pages server On_Load event (.aspx.vb) to create a collection using classes. ...
7
by: nafri | last post by:
hello all, I want to create a function that returns the first element of the Array that is input to it. However, the Input Array can be an Array of points, double, or anyother type, which means...
1
by: Thomas D. | last post by:
Hello all, I'm using the IXmlSerializable interface for a project and encounter some problems when testing my webservice in a client application. I know this interface is undocumented and not...
6
by: Joe | last post by:
Hello All: I have a webform (WebForm1.aspx) that retrieves a value from a database (_formSessionId) the first time that it is posted. After the user filles in the form, he/she clicks a Button...
4
by: Robert Schneider | last post by:
Hi, the msdn documentation provides an Dinosaurs example that uses the objectmodel.collection class. Just have a look on the help page for this class. I don't understand what happens here. Or...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.