Is the Page_Load function called, when you change the value?
Maybe you have to check in the Page_Load function if it is a postback or not and not reset the values of the page.
in c#, you can do that with
if (!Page.IsPostBack)