Results 1 to 5 of 5

Thread: Passing Classes from page to page *Resolved*

  1. #1

    Thread Starter
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Resolved Passing Classes from page to page *Resolved*

    Hey everyone.... not much of a ASP.NET person so I gotta ask, how do I pass a class object from page to page (it basically contains all the data for a form that spans multiple pages)

    I imagine I gotta use a session variable.... is this along the lines of correct?

    dim myCls as new myClass("Hi","there")
    dim MyCls2 as new myClass()
    session.add("myCls", myCls)
    myCls2 = session.item("myCls")

    Edit: I was close

    myCls2 = ctype(session.item("myCls"), myClass))
    Last edited by Graff; Mar 23rd, 2005 at 12:45 PM.
    If wishes were fishes we'd all cast nets.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Passing Classes from page to page

    You can use either the Session or Application objects to store data. You could also serialize the class into XML and pass by querystring
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Re: Passing Classes from page to page

    I figured it out how to pass via session. Not really interested in learning serialization and xml stuff this late in the game.
    If wishes were fishes we'd all cast nets.

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Passing Classes from page to page

    Only thing to bear in mind is that objects stored in the Session object are disposed of when that user's session expires. Around 20 minutes I think or something - I'm not 100% on that.

    Object stored in the Application object however persist until the application itself is shutdown.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5

    Thread Starter
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Re: Passing Classes from page to page *Resolved*

    The server is configured so that the session should remain active as long as the user is view it (its an intranet webapp so we're not as concerned about the duration length)
    If wishes were fishes we'd all cast nets.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width