This time I bring a little problem that is stinging me. It's about that I have a form of a web solution in c # with asp.net that I want to edit. The data I want to edit is a table called User made in Sql Server.
The data of a particular user I have been able to recover, I have even put in the form so that you can see what you want to change. But when I delete the text box to put a new datum and press update, it keeps the same values I had before I deleted them.
I have noticed that every time I press update the page is loaded again from the Load, which is where I recover the data. From what I see, that is the problem. I'm not very familiar with this language and that's why I've been struggling with this update section.
protected void Page_Load(object sender, EventArgs e)
{
idUsuario = actualizar.getId();
Modificacion modificacion = new Modificacion();
txtNombre.Text = modificacion.mostrarNombre(idUsuario.ToString());
txtCorreo.Text = modificacion.mostrarCorreo(idUsuario.ToString());
txtUsuario.Text = modificacion.mostrarUsuario(idUsuario.ToString());
}
The action that the update button produces is:
protected void btnActualizar_Click(object sender, EventArgs e)
{
String nombre = txtNombre.Text;
String correo = Convert.ToString(txtCorreo.Text);
String user = Convert.ToString(txtUsuario.Text);
String estado = listEstado.SelectedValue;
Actualizacion actualizacion = new Actualizacion();
if (estado.Equals("Activo"))
{
actualizacion.actualizarUsuario(idUsuario.ToString(), nombre, correo, user, "1");
}
else
{
actualizacion.actualizarUsuario(idUsuario.ToString(), nombre, correo, user,"2");
}
}
In short, my goal is to show the user's data in the text boxes without, when I delete the data and write the new information, I continue adding the values that I found from the database. I would greatly appreciate the help of this community. Thanks.