473,513 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object across pages

I have a web applicatin with 2 web forms.Form 1 contains 2 textboxes -
txtName, txtAge and Submit button. Form 2 Contains 2 textboxes - txtsubject,
txtSection and submit button. I have a class Student as follows

Public Class Student
dim name as string
dim age as string
dim subject as string
dim section as string
End Class

I am storing the data entered by user in form 1 in name and age members of
the instantiated class. Then I save the class as session variable. In form 2
I am reffering to same class stored in session variable to access name and
age of student. Then I am trying to store the values of subject and section
in the same class. But i get error message.

I have Following queries regarding same.

1) How do I declare or instantiate my class so that it can be accessed
anywhere in the application and where should i instantiate it? The class
shall be instantiated as session for a user starts and should end when it
ends.

2) I want that data added to class in form 1 shall be available in form 2
and at the same time it shall be possible for me 2 add more data to same
stored class in form 2. How to do this?

Please Help...
--
Thank You.

Saket Mundra
Nov 19 '05 #1
1 1142
Hi Saket,

The anwer to both questions is the same. If you store it in Session, it will
be persistent throughout the Session, destroyed automatically when the
Session ends, and available to all pages visited by that client during that
Session.

If you could share the exact error message we could help you diagnose the
problem you're having. But you are on the right track using Session.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Saket Mundra" <Sa*********@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
I have a web applicatin with 2 web forms.Form 1 contains 2 textboxes -
txtName, txtAge and Submit button. Form 2 Contains 2 textboxes -
txtsubject,
txtSection and submit button. I have a class Student as follows

Public Class Student
dim name as string
dim age as string
dim subject as string
dim section as string
End Class

I am storing the data entered by user in form 1 in name and age members of
the instantiated class. Then I save the class as session variable. In form
2
I am reffering to same class stored in session variable to access name and
age of student. Then I am trying to store the values of subject and
section
in the same class. But i get error message.

I have Following queries regarding same.

1) How do I declare or instantiate my class so that it can be accessed
anywhere in the application and where should i instantiate it? The class
shall be instantiated as session for a user starts and should end when it
ends.

2) I want that data added to class in form 1 shall be available in form 2
and at the same time it shall be possible for me 2 add more data to same
stored class in form 2. How to do this?

Please Help...
--
Thank You.

Saket Mundra

Nov 19 '05 #2

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

Similar topics

2
2205
by: Ivan | last post by:
Hi, I have a that page opens an imap connection; I need to refer to the connection across various pages. I don't want to reopen that connection on every page (vast waste of resources). I have...
1
2093
by: Philip Chan | last post by:
I am using ASP3.0 and IIS5 I want to have OOP so I have define a class call Employee with property 'fullName' and methods like getFullName(). To save a group of employee in session, I use a...
1
2564
by: Tim Jowers | last post by:
We are using an object from a vendor into which we write data from several web pages. So far IE always seems to create a new copy of the object for each web page. Is there a way to make it behave...
3
12187
by: James Marshall | last post by:
I need to detect the type of an object, more than just "object" as typeof gives us. I'm writing a general handler that accepts a variety of objects and properties, and acts accordingly depending...
0
1434
by: Joe Blow via DotNetMonster.com | last post by:
Hello, I have a design problem involving class instances as global variables. To give you my background, I've programmed lots in Java, and most of it has been large class structures. I'm...
3
45942
by: news.rcn.com | last post by:
How can I access the request and response object for a page using javascript. I want to stick some data on with something like request.setAttribute( "User's choice for later use" ). I can't seem...
4
2792
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
3
2777
by: Bart Van der Donck | last post by:
Hello, I'm having a hard time trying to configure printed output that consists of multiple pages. The idea is the following: <div style=" border: 1px solid blue; position: absolute; top:...
22
4149
by: Cylix | last post by:
I have a 4row x 1col table, I would like to drop all the content of row three. Since Mac IE5.2 does not suppport deleteRow method, I have also try to set the innerHTML=''; but it does not work. ...
3
1657
by: Robert | last post by:
I am trying to persist an instance specific object without using a session object. Is this possible? For example: Class object: Car Properties: Make, Model Car.Make = Ford Car.Model = F150
0
7269
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,...
1
7123
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
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4756
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
3248
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
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
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
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.