I assume your talking about a web page. If so you need to realize that the variables you're defining only "live" while the server is processing the page. Once it is sent to the client, it no longer exsists on the server. To do what you're trying to do, you'll need to put the value on a hidden control on the webpage and set it's EnableViewState property to true.