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. General Programming
  3. C#
  4. Question about Session

Question about Session

Scheduled Pinned Locked Moved C#
question
5 Posts 3 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.
  • Y Offline
    Y Offline
    YiXiang_89
    wrote on last edited by
    #1

    Hi all, txt_name.Text = (string)Session["Product_Name"]; if is a integer. . . . How do i type it? txt_number.Text = Thank You

    S N 2 Replies Last reply
    0
    • Y YiXiang_89

      Hi all, txt_name.Text = (string)Session["Product_Name"]; if is a integer. . . . How do i type it? txt_number.Text = Thank You

      S Offline
      S Offline
      sanforjackass
      wrote on last edited by
      #2

      it is in string form you can do anything with it {maybe Session["Product_Name"]=null}

      modified on Saturday, January 30, 2010 4:51 AM

      1 Reply Last reply
      0
      • Y YiXiang_89

        Hi all, txt_name.Text = (string)Session["Product_Name"]; if is a integer. . . . How do i type it? txt_number.Text = Thank You

        N Offline
        N Offline
        Nuri Ismail
        wrote on last edited by
        #3

        You can type it like that:

        txt_number.Text = Session["Product_Number"].ToString();

        Y 1 Reply Last reply
        0
        • N Nuri Ismail

          You can type it like that:

          txt_number.Text = Session["Product_Number"].ToString();

          Y Offline
          Y Offline
          YiXiang_89
          wrote on last edited by
          #4

          it state: Object reference not set to an instance of an object.

          N 1 Reply Last reply
          0
          • Y YiXiang_89

            it state: Object reference not set to an instance of an object.

            N Offline
            N Offline
            Nuri Ismail
            wrote on last edited by
            #5

            YiXiang_89 wrote:

            it state: Object reference not set to an instance of an object.

            For my first answer i asumed that you have already added a Session variable of type int with name Product_Number. The point is that you can use ToString() method to get a string representation of your variable which is a numeric type. Here is a full example:

            Session["Product_Number"] = 555; //Store
            //....
            string s = Session["Product_Number"].ToString(); //Retrieve

            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