getting modified text box values

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
 
K

Ken Cox [Microsoft MVP]

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
 
W

Warren J. Hairston

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
{
....
}
 
M

Mark

Ooops..... I think that'll do it.........
compltely slipped my mind.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top