Results 1 to 12 of 12

Thread: gets null!

Hybrid View

  1. #1
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: gets null!

    Yeah seems fine

    All the objects of a specific class that I create I store in a collection, so once you create your one object on the first aspx page, chuck it into the collection to store across requests from the client and then its easy to search for that object and pull it out of the collection from the other aspx pages.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: gets null!

    sweet - ill give it a bash thanks a bunch!

    ASP.NET ROX!

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: gets null!

    sorry, i completly forgot and lost it.

    how is this going to work? how can i create an object from one aspx page, store it, and let another aspx page(s) access that object on a UID?

  4. #4
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: gets null!

    Well what you can do is once you have created your object, you can add it to your Session state (Session.Add("NameOfObject", aObject)) or Application state (Application.Add("NameOfObject", aObject)). This will store your object across requests. If you want the diff between the two go search on google :P

    Then on the next aspx page your can get your object out of that state:

    VB Code:
    1. Dim aObject as new ClassName = ctype(session.item("NameOfObject", ClassName)

    There are many other ways to do it, but this is just a simple way for storing a small amount of data.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: gets null!

    thanks

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: gets null!

    well it doesnt seem to want to accept that

    after the "=" in that code, vb.net complains that it should have expected an end statement

  7. #7
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: gets null!

    sorry

    VB Code:
    1. Dim aObject as new ClassName
    2.  
    3. aObject = CType(Session.Item("NameOfObject"), ClassName)

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