G
Guest
I have a textbox on a form that is populated from the database when the form
loads. When I check textbox.Text when the user clicks my submit button, the
value is always what it was when the form loaded, no matter of what the user
changed the text to. Any suggestions?
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = Customers.GetCustomer(Request["Customer"]);
if (ds.Tables[0].Rows.Count == 0)
return;
name.Text = ds.Tables[0].Rows[0][0].ToString();
phone.Text = ds.Tables[0].Rows[0][1].ToString();
contact.Text = ds.Tables[0].Rows[0][2].ToString();
address.Text = ds.Tables[0].Rows[0][3].ToString();
city.Text = ds.Tables[0].Rows[0][4].ToString();
state.SelectedValue = ds.Tables[0].Rows[0][5].ToString();
zip.Text = ds.Tables[0].Rows[0][6].ToString();
notes.Text = ds.Tables[0].Rows[0][7].ToString();
}
protected void editSubmit_Click(object sender, EventArgs e)
{
if (editSubmit.Text == "Edit")
{
name.ReadOnly = false;
phone.ReadOnly = false;
contact.ReadOnly = false;
address.ReadOnly = false;
city.ReadOnly = false;
state.Enabled = true;
zip.ReadOnly = false;
notes.ReadOnly = false;
editSubmit.Text = "Submit";
}
else
{
name.ReadOnly = true;
phone.ReadOnly = true;
contact.ReadOnly = true;
address.ReadOnly = true;
city.ReadOnly = true;
state.Enabled = false;
zip.ReadOnly = true;
notes.ReadOnly = true;
editSubmit.Text = "Edit";
string s = name.Text;
Response.Redirect("CustomerDetails.aspx?Customer=" + s, false);
}
}
loads. When I check textbox.Text when the user clicks my submit button, the
value is always what it was when the form loaded, no matter of what the user
changed the text to. Any suggestions?
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = Customers.GetCustomer(Request["Customer"]);
if (ds.Tables[0].Rows.Count == 0)
return;
name.Text = ds.Tables[0].Rows[0][0].ToString();
phone.Text = ds.Tables[0].Rows[0][1].ToString();
contact.Text = ds.Tables[0].Rows[0][2].ToString();
address.Text = ds.Tables[0].Rows[0][3].ToString();
city.Text = ds.Tables[0].Rows[0][4].ToString();
state.SelectedValue = ds.Tables[0].Rows[0][5].ToString();
zip.Text = ds.Tables[0].Rows[0][6].ToString();
notes.Text = ds.Tables[0].Rows[0][7].ToString();
}
protected void editSubmit_Click(object sender, EventArgs e)
{
if (editSubmit.Text == "Edit")
{
name.ReadOnly = false;
phone.ReadOnly = false;
contact.ReadOnly = false;
address.ReadOnly = false;
city.ReadOnly = false;
state.Enabled = true;
zip.ReadOnly = false;
notes.ReadOnly = false;
editSubmit.Text = "Submit";
}
else
{
name.ReadOnly = true;
phone.ReadOnly = true;
contact.ReadOnly = true;
address.ReadOnly = true;
city.ReadOnly = true;
state.Enabled = false;
zip.ReadOnly = true;
notes.ReadOnly = true;
editSubmit.Text = "Edit";
string s = name.Text;
Response.Redirect("CustomerDetails.aspx?Customer=" + s, false);
}
}