sd_dracula
sd_dracula

Reputation: 3896

asp.net postback and database store

I have a form with a couple of textboxes and in Page_Load I set the default values (ie: for the date textbox the default is today's datetime).

When clicking a Submit button it adds a record to the DB via a stored procedure. The problem I am having is that when I click the Submit button it does not take the current textbox values and stores them in the DB.

What it seems to do is, do a postback and then store them. Meaning that if I change the default values, it will still store the default ones and not the new values.

I need the date field to be calculated on every postback, because I need the datetime down to the millisecond.

How can I fix this issue?

Upvotes: 0

Views: 230

Answers (1)

Jasper
Jasper

Reputation: 534

Are you setting the default values on !Page.IsPoatback ? Otherwise you would always overwrite the values before saving the filled in values.

Upvotes: 1

Related Questions