473,672 Members | 2,268 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 1144
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*********@di scussions.micro soft.com> wrote in message
news:BB******** *************** ***********@mic rosoft.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
2214
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 tried using sessions but they do not persist objects across pages the php manual says that too. I have searched all websites/forums and nobody seems to bring
1
2102
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 dictionary. ----------------- dim employees set employees = CreateObject("Scripting.Dictionary")
1
2570
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 like applets so the data is retained as the object is only created one time? By design we are not doing a form POST until after many pages. So far, the only solutions seem to be to put everything in a frame and put the object in the outer frame...
3
12194
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 on which type of object it gets. Object types to be handled include windows, documents, locations, links, images, layers, and so on. I'm using Mozilla, but I'm looking for a platform-independent solution. I know of four potential approaches to...
0
1447
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 learning c# the hard way, but the similarities to Java are very helpful. However, in this case they are hurting, because I can't figure out the best way to store a class that can be accessed across the scope of an ASP.NET application. To begin with,...
3
45965
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 to find a reference to request or response objects in JavaScript either in Google Groups or O'Reilly's "JavaScript the Definitive Guide" (surely it should be in the latter, huh?) I know I could use a hidden form element but the data would be a...
4
2801
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 one runat=server form on a asp.net page. However, I still want developers to be able to use asp.net controls to create some apps that are created on the page. So I need multiple forms on a asp.net page(doesn't everyone). I purchased the...
3
2789
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: 20px; left: 20px;
22
4179
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. How can I delete the node from DOM in other way? Thanks.
3
1670
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
8488
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8408
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8932
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8832
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5709
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4230
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2067
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1819
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.