Newbie998
December 18th, 2006, 02:33 PM
Hello
I have a form asking for name, address etc.
I have two buttons.
When the user presses the first button the content from the form is
presented in labels (on the same page).
When the second button is pressed, the content is inserted into a database.
Because there are two buttons, there are two methods:
protected void buttonName_Click(object sender, EventArgs e)
When the first button is clicked all strings containing values from the form will be null. Probably because the page reloads.
I need to keep the values, because the second button is for insterting to database. The only way I know is to make the strings static.
Like this:
static string name = textboxName.Text;
But that doesn't seem like a good idea.
How do I solve this the easiest way?
Thanks
I have a form asking for name, address etc.
I have two buttons.
When the user presses the first button the content from the form is
presented in labels (on the same page).
When the second button is pressed, the content is inserted into a database.
Because there are two buttons, there are two methods:
protected void buttonName_Click(object sender, EventArgs e)
When the first button is clicked all strings containing values from the form will be null. Probably because the page reloads.
I need to keep the values, because the second button is for insterting to database. The only way I know is to make the strings static.
Like this:
static string name = textboxName.Text;
But that doesn't seem like a good idea.
How do I solve this the easiest way?
Thanks