getting modified text box values

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi,
I have an aspx page, that in the PageLoad sub, gets values from a specific
record in a database as where the record id is retrieved from the
querystring. Thesee values are then used to populate a series of text boxes,
radio button selections and drop down list selections. This all works.

I run into a problem when I change the values of one of these populated
items. When a button is clicked to update the database with the modified
data, the event fires, but the data is not updated. If I hard code string
data in, instead of using the data from the textboxes (or drop list or radio
button), the changes appear in the database as expected.
Why are the changes to the text box data not appearing in the db, and how
can I fix this?


TIA,
Mark
 
Hi Mark,

It is hard to diagnose without seeing your code, but have you remembered to
use "if not ispostback" in the Load event? You don't want to keep filling
the textbox with the original value.

Ken
 
It sounds like your page is resetting the values to the original data from
the database on PostBack. Is the code that initializes everything executing
each time Page_Load is called, or just during the initial Page_Load?
Remember, Page_Load gets called once when the page initially loads, once
during each PostBack.

Make sure your initialization code in Page_Load is wrapped in the following
(if you're using C#):

if (!IsPostBack) //not in PostBack
{
....
}
 
Ooops..... I think that'll do it.........
compltely slipped my mind.

Thank you both for the kick in the pants ;-)
 
Back
Top