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. Global variables and ViewState

Global variables and ViewState

Scheduled Pinned Locked Moved C#
csscomcollaborationquestion
2 Posts 2 Posters 1 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.
  • A Offline
    A Offline
    Alex Getman
    wrote on last edited by
    #1

    Hi Gurus! I writting some kind of Web Application and here I got a few WebForms and I need to exchange some variables between these pages. Usually when on page1 user pick up some value in Grid I wrote following code Response.Redirect("../page1.aspx?MyVar="+textBox1.Text); actually I just making a page redirect on itself and then in page class I defined private static string MyVar=""; and OnLoad I wrote if(!this.IsPostBack) { if(Request["MyVar"]!="") { MyVar = Request["MyVar"]; DoSomeWork(MyVar); } } So i want ot ask you is this optimal solution to store page variables? I mean maybe exists some better solution then redirect page on itself? Maybe I should use ViewState to store page variables or somth.? xedom developers team

    S 1 Reply Last reply
    0
    • A Alex Getman

      Hi Gurus! I writting some kind of Web Application and here I got a few WebForms and I need to exchange some variables between these pages. Usually when on page1 user pick up some value in Grid I wrote following code Response.Redirect("../page1.aspx?MyVar="+textBox1.Text); actually I just making a page redirect on itself and then in page class I defined private static string MyVar=""; and OnLoad I wrote if(!this.IsPostBack) { if(Request["MyVar"]!="") { MyVar = Request["MyVar"]; DoSomeWork(MyVar); } } So i want ot ask you is this optimal solution to store page variables? I mean maybe exists some better solution then redirect page on itself? Maybe I should use ViewState to store page variables or somth.? xedom developers team

      S Offline
      S Offline
      Syed Abdul Khader
      wrote on last edited by
      #2

      Refer the good article about state management. http://www.informit.com/articles/article.asp?p=31842[^]

      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