Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Passing Multiple objects from page to page

Passing Multiple objects from page to page

Scheduled Pinned Locked Moved ASP.NET
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zami_2
    wrote on last edited by
    #1

    Problems are: 1. if i want to send multiple objects like one string and one int, how can i do it? 2. Let there is a class: class MyClass{ String id, name, address; MyClass(){...} } If i want to send a MyClass type object from one page to another what should i do now?

    K 1 Reply Last reply
    0
    • Z Zami_2

      Problems are: 1. if i want to send multiple objects like one string and one int, how can i do it? 2. Let there is a class: class MyClass{ String id, name, address; MyClass(){...} } If i want to send a MyClass type object from one page to another what should i do now?

      K Offline
      K Offline
      KrIstOfK
      wrote on last edited by
      #2

      Zami_2 wrote:

      1. if i want to send multiple objects like one string and one int, how can i do it?

      strString = "myValue";
      iInt = 10;
      Response.Redirect("myurl.aspx?stringIWishToPass=" + strString + "&intIWishToPass=" + iInt.ToString());

      on myurl.aspx you can get this data like:

      string strString = Request.QueryString["stringIWishToPass"];
      int iInt = Convert.ToInt32(Request.QueryString["intIWishToPass"]);

      Zami_2 wrote:

      2. Let there is a class: class MyClass{ String id, name, address; MyClass(){...} } If i want to send a MyClass type object from one page to another what should i do now?

      MyClass myVar = new MyClass();
      myVar.Name = "name";
      ...
      Session.Add["something", myVar];
      Response.Redirect("myurl.aspx");

      on myurl.aspx you can get the data as following:

      MyClass myVar = (MyClass)Session["something"];

      Greetings, KrIstOfK

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups