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. global variables

global variables

Scheduled Pinned Locked Moved ASP.NET
7 Posts 5 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.
  • V Offline
    V Offline
    vengaqua
    wrote on last edited by
    #1

    What is the best practice if i want some information to be available in all the forms. Is it good to have global variables. If not then please tell me some other alternative.

    Mohinder Singh

    S N 2 Replies Last reply
    0
    • V vengaqua

      What is the best practice if i want some information to be available in all the forms. Is it good to have global variables. If not then please tell me some other alternative.

      Mohinder Singh

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      I think one of the best way is creating the datacontainer class and storing there by having private variables and public properties. There are many ways to store but depends on the size,security ...........

      Thanks and Regards Sandeep If you want something you never had, do something you have never done!

      V 1 Reply Last reply
      0
      • V vengaqua

        What is the best practice if i want some information to be available in all the forms. Is it good to have global variables. If not then please tell me some other alternative.

        Mohinder Singh

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        You can use sessions also

        Cheers Navaneeth!! www.w3hearts.com

        V A 2 Replies Last reply
        0
        • S Sandeep Akhare

          I think one of the best way is creating the datacontainer class and storing there by having private variables and public properties. There are many ways to store but depends on the size,security ...........

          Thanks and Regards Sandeep If you want something you never had, do something you have never done!

          V Offline
          V Offline
          vengaqua
          wrote on last edited by
          #4

          can u give me the code for this. Thanks in advance

          Mohinder Singh

          A 1 Reply Last reply
          0
          • N N a v a n e e t h

            You can use sessions also

            Cheers Navaneeth!! www.w3hearts.com

            V Offline
            V Offline
            vengaqua
            wrote on last edited by
            #5

            how to use session. can u send me the code for it. Thanks in advance.

            Mohinder Singh

            1 Reply Last reply
            0
            • V vengaqua

              can u give me the code for this. Thanks in advance

              Mohinder Singh

              A Offline
              A Offline
              ADY007
              wrote on last edited by
              #6

              To make sessions you need to create it like this; Session("Name") = "Adrian" This Session is now stored with a string called "Adrian". This session can be called from any page you want within the project. If you want to dispose the session; Session.RemoveAll() I hope i helped you in some ways.

              Adrian De Battista - Web Designer, Web Programmer, Software Programmer From Malta. My Website .. www.MaltaTrade.org

              1 Reply Last reply
              0
              • N N a v a n e e t h

                You can use sessions also

                Cheers Navaneeth!! www.w3hearts.com

                A Offline
                A Offline
                amin_behzadi
                wrote on last edited by
                #7

                Suppose that I want to send a private message to a person and sender name and reciever name is saved in 2 session variables like this.Session["sender"] and this.Session["Reciever"]. Now I open 2 browser and in browser one ,click on person1 "send message" bottun and go to a page to writing message body, and then in browser 2 click on person2 "send message" bottun and go to a page...! Now I go to browser 1 and click on "Send" bottun. the value of this.Session["reciever"] is person2 but I want to send message to person 1 . What should we do in this case ?

                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