Results 1 to 2 of 2

Thread: global inside an aspx file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183

    global inside an aspx file

    Is there a way to make a variable global to an entire aspx file? I tried to just sticking it at the top where the declarations for the buttons ect go, but whenever I make changes to this variable they don't seem to stick. any ideas?

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    You can add variables to the viewstate. It has to be stored as a string and you must a have a <form runat="server"> on every page:-

    ViewState("myvar") = "hello"
    dim MyVar as string = cstr(ViewState("myvar"))

    or for a number

    ViewState("myint") = "10"
    dim MyVar as string = int32.parse(ViewState("myvar"))

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