I haven't found a solution to this problem but I think it has to be something very simple.

I have an asp:Textbox in my page that fills with text from a database on page_load,
this works fine, the thing is that if I change the text and click in an asp:button that should retrieve the updated text, the code in the click event keeps getting the same value as if the textbox had the same text from the database and nothing had happen to it.

Why am I getting the same value?

Thanks in advance.

On page postback the page is retaining the initially loaded value because the database code is being called again.
You will want your database code to be called inside this structure:

if(!Page.IsPostBack) {
  // call code to populate from database

Now that code only runs when the page is first loaded and not on postbacks (which happen when you click a button). The new value entered into textbox should now persist.
Hope that helps,


Thanks, yes that was the problem, it makes sense, I was overwriting the textbox everytime I did a postback.

Thanks for your help