Tudor Gafiuc
Tudor Gafiuc

Reputation: 145

textbox.text to string has no value?

I have the following code:

//old code

where txt_fname and the others are TextBox IDs. The textboxes contain strings, but when I use a method for submit_Click to insert the values in the DB, they are not inserted. The DB keeps the old values.

The insert method is

//old code

and i know it works because u_date is always inserted correctly.

Any ideas why the strings are blank?

Here is the full code for the submit button:

//old code

Upvotes: 1

Views: 405

Answers (1)

Grant Thomas
Grant Thomas

Reputation: 45083

I'd hazard a guess that you're not utilising the IsPostBack property in the page load event handler, and unintentionally overwriting the value(s).

Be sure to do something like

if (!IsPostBack) {
  // manipulate control values only if loading
}

If you'd provide more information with regards to what's happening on page load we might have better luck at a diagnoses.

Upvotes: 1

Related Questions