IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP.NET Discussion :

Champs texte vidés apres clic sur un boutton, postback ?


Sujet :

ASP.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    259
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2003
    Messages : 259
    Par défaut Champs texte vidés apres clic sur un boutton, postback ?
    Bonjour,
    mes champs sont vidés/effacés apres un clic sur un boutton d'enregistrement , pourquoi ?
    Du coup j'enregistre du vide avec ma requette
    J'ai des champs qui sont réinitialisés,comme si la page était rechargée.

  2. #2
    Membre éclairé Avatar de Ishizaki
    Inscrit en
    Avril 2006
    Messages
    262
    Détails du profil
    Informations forums :
    Inscription : Avril 2006
    Messages : 262
    Par défaut
    Ne serait-ce pas un soucis de PostBack ?

    Ou tu pourrais nous montrer un bout de code.

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    259
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2003
    Messages : 259
    Par défaut
    je pense aussi que c'est ça. Je ne suis pas au taff mais si c'est le cas, comment le regler ?
    Merci !

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    259
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2003
    Messages : 259
    Par défaut
    voici le code html :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
     
    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MyProfile.aspx.cs" Inherits="MyProfile" Title="Page sans titre" %>
    <%@ Register assembly="Artem.GoogleMap" namespace="Artem.Web.UI.Controls" tagprefix="artem" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     
        <table>
    <tr><td>
        <table>
        <tr>
           <td align="right"><asp:Label ID="LabelPseudo" runat="server" Text="Nom utilisateur"></asp:Label></td>
           <td align="left"> <asp:TextBox ID="Pseudo" runat="server" AutoPostBack="True"></asp:TextBox></td>
        </tr>
            <tr>
           <td align="right"><asp:Label ID="LabelEmail" runat="server" Text="Email"></asp:Label></td>
           <td align="left" > <asp:TextBox ID="Email" runat="server" Width="300px" ></asp:TextBox></td>
        </tr>
        <tr>
            <td align="right"><asp:Label ID="LabelNom" runat="server" Text="Nom"></asp:Label></td>
            <td align="left"><asp:TextBox ID="Nom" runat="server"></asp:TextBox></td>
     
        </tr>
        <tr>
            <td align="right"><asp:Label ID="LabelPrenom" runat="server" Text="Prénom"></asp:Label></td>
            <td align="left"><asp:TextBox ID="Prenom" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td align="right"> <asp:Label ID="LabelAdresse" runat="server" Text="Adresse"></asp:Label></td>
            <td align="left"><asp:TextBox ID="adresse1" runat="server" Width="300px"></asp:TextBox></td>
        </tr>
          <tr>
            <td align="right"><asp:Label ID="LabelAdresse2" runat="server" Text="Complément"></asp:Label></td>
            <td align="left"><asp:TextBox ID="adresse2" runat="server" Width="300px"></asp:TextBox></td>
        </tr>
        <tr>
            <td align="right"> <asp:Label ID="LabelCP" runat="server" Text="Code Postal"></asp:Label></td>
            <td align="left"><asp:TextBox ID="CP" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td align="right"> <asp:Label ID="LabelVille" runat="server" Text="Ville"></asp:Label></td>
            <td align="left"><asp:TextBox ID="Ville" runat="server" Width="300px"></asp:TextBox></td>
        </tr>
        <tr>
            <td align="right"> <asp:Label ID="LabelPays" runat="server" Text="Pays"></asp:Label></td>
            <td align="left"><asp:DropDownList id="Pays" runat="server">
    <asp:ListItem Value="" Selected="true">Choisir un Pays</asp:ListItem>
    <asp:ListItem Value="AF">Afghanistan</asp:ListItem>
    <asp:ListItem Value="AL">Albania</asp:ListItem>
    </asp:DropDownList></td>
        </tr>
     
        <tr><!-- bouton valider-->
            <td align="center"></td>
            <td align="left">
                <asp:Button ID="Button1" runat="server" Text="VALIDER" Width="166px" 
                    BackColor="#FFFBFF" BorderColor="#CCCCCC" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" 
                    ForeColor="#A7C520" onclick="Button1_Click"/>
            </td>
        </tr>
     
           <tr>
            <td align="center"></td>
            <td align="center">
                <a href="ChangePassword.aspx">Changer votre mot de passe</a>
            </td>
        </tr>
     
        </table>
        </td>
        <td><!-- espace googlemap-->
            <div>
     
    <artem:GoogleMap ID="GoogleMap1" runat="server">
    </artem:GoogleMap>
     
     
        </div>
     
        </td></tr></table>
     
    </asp:Content>
    La balise form de la masterpage est en method="Post"

    le code c# :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
        protected void Button1_Click(object sender, EventArgs e)
        {
     
            // Populate some Profile properties off of the create user wizard
            Profile.Nom = this.Nom.Text;
            Profile.Prénom = this.Prenom.Text;
            Profile.Adresse1 = this.adresse1.Text;
            Profile.Adresse2 = this.adresse2.Text;
            Profile.CP = this.CP.Text;
            Profile.Ville = this.Ville.Text;
            Profile.Pays = this.Pays.SelectedValue;
     
        }

  5. #5
    Membre extrêmement actif
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 240
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 1 240
    Par défaut
    tu as mis enableviewstate=true dans tes controls?

  6. #6
    Membre éclairé
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    259
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2003
    Messages : 259
    Par défaut
    oui pour tous les champs texte, c'est à true

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 11
    Dernier message: 04/12/2010, 06h42
  2. [MySQL] validation aprés clic sur buton submit
    Par bwatex dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 28/11/2006, 14h50
  3. Réponses: 4
    Dernier message: 28/11/2006, 13h55
  4. Réponses: 4
    Dernier message: 07/11/2006, 23h00
  5. [JSP] Réaliser un traitement après clic sur un lien donné
    Par Ataman dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 25/06/2006, 10h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo