Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2006, 04:34 PM
Authorized User
 
Join Date: Dec 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with textbox

protected System.Web.UI.WebControls.TextBox txtPrenom;
protected System.Web.UI.WebControls.TextBox txtNom;
protected System.Web.UI.WebControls.TextBox txtCourriel;
protected System.Web.UI.WebControls.TextBox txtAdresse;
protected System.Web.UI.WebControls.TextBox txtVille;
protected System.Web.UI.WebControls.TextBox txtProvince;
protected System.Web.UI.WebControls.TextBox txtPays;
protected System.Web.UI.WebControls.TextBox txtCodePostal;
protected System.Web.UI.WebControls.TextBox txtTelephone;

in my page_load I do something like this :

txtNom.Text = objUsager.Nom;
txtPrenom.Text = objUsager.Prenom;
txtCourriel.Text = objUsager.Courriel;
txtAdresse.Text = objUsager.Adresse;
txtVille.Text = objUsager.Ville;
txtProvince.Text = objUsager.Province;
txtPays.Text = objUsager.Pays;
txtCodePostal.Text = objUsager.CodePostal;
txtTelephone.Text = objUsager.NoTel;

But when I try to get back the "change" in the texte box in

private void cmdUpdate_Click(object sender, System.EventArgs e)
{
    objUsager.Nom = txtNom.Text;
    objUsager.Prenom = txtPrenom.Text;
    objUsager.Courriel = txtCourriel.Text;
    objUsager.Adresse = txtAdresse.Text;
    objUsager.Ville = txtVille.Text;
    objUsager.Province = txtProvince.Text;
    objUsager.Pays = txtPays.Text;
    objUsager.CodePostal = txtCodePostal.Text;
    objUsager.NoTel = txtTelephone.Text;
    objUsager.Update();
}

I only get the value I had in my page load and not the modification I've made in the page...

Is there somebody who know why and howto fix this?
 
Old January 12th, 2006, 11:21 AM
Authorized User
 
Join Date: Dec 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I solve my problem by putting a if(!IsPostBack) before

txtNom.Text = objUsager.Nom;
txtPrenom.Text = objUsager.Prenom;
txtCourriel.Text = objUsager.Courriel;
txtAdresse.Text = objUsager.Adresse;
txtVille.Text = objUsager.Ville;
txtProvince.Text = objUsager.Province;
txtPays.Text = objUsager.Pays;
txtCodePostal.Text = objUsager.CodePostal;
txtTelephone.Text = objUsager.NoTel;

In my page load

Thanks again






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with DateTime and Textbox MAKO C# 5 July 28th, 2006 10:09 AM
a problem with textbox typing, thanks! raybristol ASP.NET 1.0 and 1.1 Basics 2 December 16th, 2005 06:02 PM
textbox problem dr_luxure VB.NET 2002/2003 Basics 3 April 10th, 2005 03:33 PM
textbox Maxlength problem ashu_gupta75 Classic ASP Basics 5 May 6th, 2004 03:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.