amillyard
asked on
text field entry -- not updating string
A bit puzzling ... is that I have a text entry field :: TextBox.TestField
as the aspx page load, there is db read of existing field data as follows:
if (rdr[0] != DBNull.Value)
TextBox_TestField.Text = (string)rdr[0];
this works fine.
I edit that field, i.e. add / amend the field content.
Obviously want to save the amended details -- and then run a sql update scripte on that field... the sql update script is ok -- but the problem is that the TextBox_TestField does seemed to have changed -- so when posting to sql it keeps original loaded data, yet on-screen *web-page) I see the updated value.
Scatching my head on this one ... should be obvious to solve, but perhaps I need more caffeine !
Any help with this would be much apprieated.
as the aspx page load, there is db read of existing field data as follows:
if (rdr[0] != DBNull.Value)
TextBox_TestField.Text = (string)rdr[0];
this works fine.
I edit that field, i.e. add / amend the field content.
Obviously want to save the amended details -- and then run a sql update scripte on that field... the sql update script is ok -- but the problem is that the TextBox_TestField does seemed to have changed -- so when posting to sql it keeps original loaded data, yet on-screen *web-page) I see the updated value.
Scatching my head on this one ... should be obvious to solve, but perhaps I need more caffeine !
Any help with this would be much apprieated.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wow - impressive, you are both 'spot on'.
added the : if (!Page.IsPostBack) to isolate the page_load section.
I was getting slightly confused on this occassion with the postback I think -- as I was not using any obvious postback (i.e. drop-down lists requiring page refresh etc).
Just that once the db update was performed, there is a redirect command within the same procedure, which moves to another page automatically -- i.e.not refreshing the same page.
But, I think the point I need to understand from your advise that I should assume a postback is happening, even if not obvious.
added the : if (!Page.IsPostBack) to isolate the page_load section.
I was getting slightly confused on this occassion with the postback I think -- as I was not using any obvious postback (i.e. drop-down lists requiring page refresh etc).
Just that once the db update was performed, there is a redirect command within the same procedure, which moves to another page automatically -- i.e.not refreshing the same page.
But, I think the point I need to understand from your advise that I should assume a postback is happening, even if not obvious.
ASKER
update starts from pressing 'update' button -- goes to a procedure which contains update routine.