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

JavaScript Discussion :

Javascript et code behind


Sujet :

JavaScript

  1. #1
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut Javascript et code behind
    Bonjour,

    je suis bloquée sur mon code et j'aurai besoin d'aide.

    voila j'ouvre une page modale dans laquelle je récupère des données en javascript, dans des champs cachés.
    A la fin de cette récupération, je souhaiterai mettre à jour une dropdownlist à part d'un champ caché. j'ai une fonction C# qui fait ça mais qui se déclenche qu'à partir d'un bouton.
    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
    function recupArgLigne() {
                document.getElementById('HiddenEntete').value = reception.param2;
                switch (reception.param1) {
                    case "NewLigne":
                        {
                            document.getElementById('btnEnregistrerLigne').value = "Ajouter";
                            break;
                        }
                    case "UpdateLigne":
                        {
                            document.getElementById('btnEnregistrerLigne').value = "Modifier";
                            document.getElementById('HiddenLigne').value = reception.param3;
                            document.getElementById('txtTempsMini').value = reception.param4;
                            document.getElementById('txtTempsMaxi').value = reception.param5;
                            document.getElementById('txtObservations').value = reception.param6;
                            document.getElementById('ddlTypeOperation').value = reception.param7;
                            document.getElementById('ddlTypeBain').value = reception.param8;
                            document.getElementById('ddlTache').value = reception.param9;
                            document.getElementById('ddlGroupePgm').value = reception.param10;
                            document.getElementById('ddlTypeEmplacement').value = reception.param11;
                            document.getElementById('HiddenIDLigne').value = reception.param12;
                            document.getElementById('txtRang').value = reception.param13;
                            break;
                        }
                }
           }
    le reste de mon code
    Code html : 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
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    <body>
        <form id="formModal" method="post" runat="server">
        <br />
        &nbsp;&nbsp;&nbsp;
        <asp:Image ID="Image1" runat="server" ImageUrl="~/Resources/PCCF-LOGO.BMP" Height="50px"
            Width="85px" />
        <br />
        <br />
        <asp:HiddenField ID="HiddenMode" runat="server" />
        <asp:HiddenField ID="HiddenEntete" runat="server" />
        <asp:HiddenField ID="HiddenLigne" runat="server" />
        <asp:HiddenField ID="HiddenIDLigne" runat="server" />
    <div id="DivLigne">
            <div style="clear: both; float: left; width: 355px; height: 391px;">
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblRang" runat="server" Text="Rang" />
                    </div>
                    <div style="float: right; width: 191px;">
                        <asp:TextBox ID="txtRang" runat="server" TabIndex="1" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTempsMiniLigne" runat="server" Text="Temps mini" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtTempsMini" runat="server" TabIndex="2" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTempsMaxiLigne" runat="server" Text="Temps maxi" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtTempsMaxi" runat="server" TabIndex="3" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblObservations" runat="server" Text="Observations" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtObservations" runat="server" TabIndex="4" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTypeOperation" runat="server" Text="Type opération" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTypeOperation" runat="server" TabIndex="5" DataSourceID="sdsTypeOpe"
                            DataTextField="LIB_TYPE_OP" DataValueField="ID_TYPE_OP" Style="width: 100%">
                            <asp:ListItem Value="-1">Sélectionner une valeur</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTypeBain" runat="server" Text="Type de bain" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTypeBain" runat="server" TabIndex="6" DataTextField="LIB_TYPE_BAIN"
                            DataValueField="ID_TYPE_BAIN" DataSourceID="sdsTypeBain" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTache" runat="server" Text="Tâche" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTache" runat="server" TabIndex="7" DataSourceID="sdsTache"
                            DataTextField="LIB_TACHE" DataValueField="ID_TACHE" Style="width: 100%">
                            <%--<asp:ListItem Value="-1">Sélectionner une valeur</asp:ListItem>--%>
                        </asp:DropDownList>
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblGroupeProgramme" runat="server" Text="Groupe programme" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlGroupePgm" runat="server" TabIndex="8" DataTextField="LIB_GROUPE_PROG"
                            DataValueField="ID_GROUPE_PROG" DataSourceID="sdsGroupePgm" Style="width: 100%" />
                    </div>
                </div>
                          <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblLigneReference" runat="server" Text="Ligne de référence" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlIDLigneRef" runat="server" TabIndex="10" DataTextField="RANG_LIGNE_FT"
                            DataValueField="ID_LIGNE_FT" Style="width: 100%">
                            <asp:ListItem Value="-1">Sélectionner une valeur</asp:ListItem>
                        </asp:DropDownList>
                        <%--DataSourceID="sdsIDLigneRef"--%>
                        <asp:Button ID="btnActualiser" Text="..." runat="server" OnClick="btnActualiser_Click" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 354px;">
                    <br />
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Button ID="btnEnregistrerLigne" Text="Enregistrer" runat="server" OnClick="btnEnregistrerLigne_Click"
                        TabIndex="5" />
                    <input type="button" value="Fermer" onclick="fermerFenetre()" tabindex="6" />
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Label ID="lblErreurLigne" runat="server" Style="font-weight: 700; color: #FF0000;"></asp:Label>
                    <asp:Label ID="lblOKLigne" runat="server" Style="font-weight: 700; color: #009933;"></asp:Label>
                </div>
            </div>
            <div title="SqlDataSource" style="clear: both; float: left">
                <asp:SqlDataSource ID="sdsTypeOpe" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TYPE_OP, LIB_TYPE_OP FROM ADMIN.TYPE_OP ORDER BY LIB_TYPE_OP">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsTypeBain" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TYPE_BAIN, LIB_TYPE_BAIN, MSG_TYPE_BAIN FROM ADMIN.TYPE_BAIN ORDER BY LIB_TYPE_BAIN">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsTypeEmplacement" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TYPE_EMPL, LIB_TYPE_EMPL FROM ADMIN.TYPE_EMPL ORDER BY LIB_TYPE_EMPL">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsGroupePgm" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_GROUPE_PROG, LIB_GROUPE_PROG, ID_PRGDEF_GROUPE_PROG FROM ADMIN.GROUPE_PROG ORDER BY LIB_GROUPE_PROG">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsTache" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TACHE, LIB_TACHE, ID_METIER_TACHE, ID_GROUPE_TACHE_TACHE FROM ADMIN.TACHE WHERE (ID_METIER_TACHE = 21) ORDER BY ID_TACHE">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsIDLigneRef" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_LIGNE_FT, MINI_LIGNE_FT, MAXI_LIGNE_FT, OBS_LIGNE_FT, RANG_LIGNE_FT, ID_TYPE_OP_LIGNE_FT, ID_TYPE_BAIN_LIGNE_FT, ID_TACHE_LIGNE_FT, ID_GROUPE_PROG_LIGNE_FT, ID_TYPE_EMPL_LIGNE_FT, ID_ENTETE_FT_LIGNE_FT, ID_REF_LIGNE_FT FROM ADMIN.LIGNE_FT WHERE (ID_ENTETE_FT_LIGNE_FT = :monEntete)">
                </asp:SqlDataSource>
            </div>
        </div>
     <script type="text/javascript" language="JavaScript">
            recupArguments() 
        </script>
        </form>
    </body>
    Ma fonction C# est la suivante:
    Code c# : 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
    protected void AffichageLigneRef()
            {
                string monEntete = HiddenEntete.Value;
                sdsIDLigneRef.SelectCommand = "SELECT ID_LIGNE_FT, MINI_LIGNE_FT, MAXI_LIGNE_FT, OBS_LIGNE_FT, RANG_LIGNE_FT, ID_TYPE_OP_LIGNE_FT, ID_TYPE_BAIN_LIGNE_FT, ID_TACHE_LIGNE_FT, ID_GROUPE_PROG_LIGNE_FT, ID_TYPE_EMPL_LIGNE_FT, ID_ENTETE_FT_LIGNE_FT, ID_REF_LIGNE_FT FROM ADMIN.LIGNE_FT WHERE (ID_ENTETE_FT_LIGNE_FT = '" + monEntete + "') ORDER BY RANG_LIGNE_FT";
                try
                {
                    ddlIDLigneRef.DataSource = sdsIDLigneRef;
                    ddlIDLigneRef.Visible = true;
                    ddlIDLigneRef.Items.Clear();
                    ddlIDLigneRef.DataBind();
                    ddlIDLigneRef.Items.Insert(0, "Sélectionner une valeur");
     
                    if (HiddenMode.Value == "UpdateLigne")
                    {
                        ddlIDLigneRef.SelectedIndex = Convert.ToInt32(HiddenIDLigne.Value.ToString());
                    }
                    btnActualiser.Visible = false;
                }
                catch (Exception e1)
                {
                    ddlIDLigneRef.Visible = false;
                }
            }

    Comment faire pour qu'à la fin de l'ouverture de ma page, je puisse lancer ma fonction C#.
    Je sais pas si ma question est clair.

    Merci pour votre aide.
    Sophie

  2. #2
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    C#=> coté serveur

    Html js => coté client

    fin de chargement de page = coté client le onlaod du body

    il te faudra donc retourner sur le serveur à la fin du chargement de la page
    regarde du coté d'ajax ...
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  3. #3
    Membre régulier
    Homme Profil pro
    Inscrit en
    Août 2010
    Messages
    130
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations forums :
    Inscription : Août 2010
    Messages : 130
    Points : 82
    Points
    82
    Par défaut
    Hi!

    Ton body coté client (ajoutes un id):
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    <body runat="server" id="masterbody">

    dans le code c# (serveur) ajoutes une reference au body:
    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    masterbody.Attributes.Add("onload", "javascript:myFunction();")

    c'est quelque chose comme ca. Sinon tu devrais trouver un moyen d'appeller la bonne méthode C# peut etre au lieu de javascript:myFunction();

  4. #4
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut Javascript et code behind
    Bonjour merci pour votre aide.

    j'ai essayé la méthode de n2engineer5.

    J'ai ajouté dans ma fonction Page_Load()
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    formModal.Attributes.Add("onload","javascript:recupArguments();");
    Ma fonction javascript ne s'exécute pas.

    Peut être qu'il faut que je mette cette instruction ailleurs mais je ne vois pas où.
    Pourriez vous me dire?

    Merci bcp.

  5. #5
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    formModal.Attributes.Add("onload","javascript:recupArguments();");
    En même temps, ta fonction JavaScript s'appelle recupArgLigne()...

    Et au passage si je mets
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    formModal.Attributes.Add("onload","crepeSuzette:recupArguments();");
    Ca me fera des crèpes suzettes ?
    Pour rappel, le pseudoprotocole javascript: est strictement inutile : A quoi sert 'javascript:' dans une balise HTML ?
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  6. #6
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut Javascript et code behind
    oui ma fonction s'appelle RecupArgligne() (qui est appelé dans recupArguments()).
    Ce que j ecomprend spas c'est pourquoi ça ne fonctionne pas.

    En mettant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    formModal.Attributes.Add("onload", "recupArguments();");
    dans mon page_load pourquoi ça ne lance pas ma fonction javascript.

    il faudrait que ma fonction C# soit lancée à la fin de ma fonction javascript afin que mes données soient dans mes champs cachés. comment puis je faire? (au lieu de lancer le javascript dans mon page_load)

  7. #7
    Expert éminent
    Avatar de sekaijin
    Homme Profil pro
    Urbaniste
    Inscrit en
    Juillet 2004
    Messages
    4 205
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Urbaniste
    Secteur : Santé

    Informations forums :
    Inscription : Juillet 2004
    Messages : 4 205
    Points : 9 127
    Points
    9 127
    Par défaut
    comme déjà dit au débu de la discution le C# c'est côté seveur

    alors si à la place de nous donner des bout de code serveur tu nous posté le HTML de ton navigateur (Côté client donc)
    peut être verrions nous ce qui cloche.

    A+JYT

  8. #8
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut Javascript et code behind
    Bonjour

    comme demandé voici tout mon code client.
    Mon problème est donc sur la partie "<div id="DivLigne">" (ligne 270 à 397). Dans mon javascript, c'est la partie qui concerne "NewLigne" et "UpdateLigne" (fonction ligne 79 à 104)
    J'aimerai que le bouton btnActualiser soit masquer et qu'à l'ouverture de ma fenêtre, le code qui est derrière soit exécuté( ligne 361).
    Merci bcp pour votre aide.
    Cordialement.

    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
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
     
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrmFTMAJ.aspx.cs" Inherits="WebGDT.FrmFTMAJ"
        Title="Mise à jour des FT." %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Mise à jour des FT.</title>
        <base target="_self" />
        <script language="JavaScript" type="text/javascript">
            var reception = window.dialogArguments;
            //Fermeture de la fenêtre modale
            function fermerFenetre() {
                window.open("", "_self").close();
            }
     
            //récupération des données entetes
            function recupArguments() {
                document.getElementById('HiddenMode').value = reception.param1;
                document.getElementById("DivLigne").style.display = "none";
                document.getElementById('DivEntete').style.display = "none";
                document.getElementById('DivArticle').style.display = "none";
                switch (reception.param1) {
                    case "NewEntete":
                        {//on met rien et ça exécute le traitement de UpdateEntete
                        }
                    case "UpdateEntete":
                        {
                            document.getElementById('DivEntete').style.display = "block";
                            recupArgEntete();
                            break;
                        }
                    case "NewLigne":
                        {//on met rien et ça exécute le traitement de UpdateLigne
                        }
                    case "UpdateLigne":
                        {
                            document.getElementById("DivLigne").style.display = "block";
                            recupArgLigne();
                            break;
                        }
                    case "NewArticle":
                        {//on met rien et ça exécute le traitement de UpdateArticle
                        }
                    case "UpdateArticle":
                        {
                            document.getElementById('DivArticle').style.display = "block";
                            recupArgArticle();
                            break;
                        }
                }
            }
     
            //fonctions par type
            function recupArgEntete() {
                document.getElementById('lblNumeroArticle').value = reception.param2;
                switch (reception.param1) {
                    case "NewEntete":
                        {
                            document.getElementById('btnEnregistrerEntete').value = "Ajouter";
                            document.getElementById('lblNumeroArticle').readonly = true;
                            break;
                        }
                    case "UpdateEntete":
                        {
                            document.getElementById('btnEnregistrerEntete').value = "Modifier";
                            document.getElementById('txtIndice').value = reception.param3;
                            document.getElementById('txtIndice').readonly = true;
                            document.getElementById('txtEdition').value = reception.param4;
                            document.getElementById('txtEdition').readonly = true;
                            document.getElementById('txtMini').value = reception.param5;
                            document.getElementById('txtMaxi').value = reception.param6;
                            document.getElementById('HiddenEntete').value = reception.param7;
                            break;
                        }
                }
            }
     
            function recupArgLigne() {
                document.getElementById('HiddenEntete').value = reception.param2;
                switch (reception.param1) {
                    case "NewLigne":
                        {
                            document.getElementById('btnEnregistrerLigne').value = "Ajouter";
                            break;
                        }
                    case "UpdateLigne":
                        {
                            document.getElementById('btnEnregistrerLigne').value = "Modifier";
                            document.getElementById('HiddenLigne').value = reception.param3;
                            document.getElementById('txtTempsMini').value = reception.param4;
                            document.getElementById('txtTempsMaxi').value = reception.param5;
                            document.getElementById('txtObservations').value = reception.param6;
                            document.getElementById('ddlTypeOperation').value = reception.param7;
                            document.getElementById('ddlTypeBain').value = reception.param8;
                            document.getElementById('ddlTache').value = reception.param9;
                            document.getElementById('ddlGroupePgm').value = reception.param10;
                            document.getElementById('ddlTypeEmplacement').value = reception.param11;
                            document.getElementById('HiddenIDLigne').value = reception.param12;
                            document.getElementById('txtRang').value = reception.param13;
                            break;
                        }
                }
            }
     
            function recupArgArticle() {
                document.getElementById('HiddenEntete').value = reception.param2;
                switch (reception.param1) {
                    case "NewArticle":
                        {
                            document.getElementById('btnEnregistrerArticle').value = "Ajouter";
                            break;
                        }
                    case "UpdateArticle":
                        {
                            document.getElementById('btnEnregistrerArticle').value = "Modifier";
                            document.getElementById('DdlArticle').value = reception.param3;
                            document.getElementById('txtDate').value = reception.param4;
                            break;
                        }
                }
            }
     
            function masqueSaisieDate(obj) {
                if (obj.value != "") {
                    //date  
                    config_separateur(obj, "/", 2, 3);
                    config_separateur(obj, "/", 5, 6);
                    config_maxiValeur(obj, 0, 2, 31);
                    config_maxiValeur(obj, 3, 5, 12);
                    //heure
                    config_separateur(obj, " ", 10, 11);
                    config_separateur(obj, ":", 13, 14);
                    config_separateur(obj, ":", 16, 17);
                    config_maxiValeur(obj, 11, 13, 12);
                    config_maxiValeur(obj, 14, 16, 59);
                    config_maxiValeur(obj, 17, 19, 59);
                    return;
                }
            }
     
            function config_separateur(chaine, separateur, min, max) {
                var ch;
                var ch_gauche, ch_droite;
     
                ch = chaine.value;
                ch.toString();
                if ((ch.slice(min, max)) != (separateur)) {
                    ch_gauche = ch.slice(0, min);
                    ch_droite = ch.slice(min);
                    chaine.value = ch_gauche + separateur + ch_droite;
                }
            }
     
            function config_maxiValeur(chaine, min, max, valeur) {
                var ch;
                var ch_gauche, ch_droite;
     
                ch = chaine.value;
                ch.toString();
     
                if (ch.slice(min, max) > valeur) {
                    ch_gauche = ch.slice(0, min) + valeur;
                    ch_droite = ch.slice(min + 2);
                }
                else {
                    ch_gauche = ch.slice(0, min);
                    ch_droite = ch.slice(min);
                }
     
                chaine.value = ch_gauche + ch_droite;
            }
     
        </script>
        <style type="text/css">
            #lblErreurMini
            {
                width: 265px;
            }
            #lblErreurMaxi
            {
                width: 264px;
            }
            #txtMini
            {
                width: 100px;
            }
            #txtMaxi
            {
                width: 100px;
            }
        </style>
    </head>
    <body>
        <%--onload="document.getElementById('btnActualiser')'.click();"--%>
        <form id="formModal" method="post" runat="server">
        <br />
        &nbsp;&nbsp;&nbsp;
        <asp:Image ID="Image1" runat="server" ImageUrl="~/Resources/PCCF-LOGO.BMP" Height="50px"
            Width="85px" />
        <br />
        <br />
        <asp:HiddenField ID="HiddenEntete" runat="server" />
        <asp:HiddenField ID="HiddenLigne" runat="server" />
        <asp:HiddenField ID="HiddenIDLigne" runat="server" />
        <asp:HiddenField ID="HiddenMode" runat="server" On="btnActualiser_Click"/>
        <div id="DivEntete">
            <div style="clear: both; float: left; width: 355px">
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblArticle" runat="server" Text="Article" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="lblNumeroArticle" runat="server" BorderColor="Black" BorderStyle="None"
                            Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblIndice" runat="server" Text="Indice" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtIndice" runat="server" TabIndex="1" MaxLength="2" 
                            Style="width: 100%"  />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblEdition" runat="server" Text="Edition" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtEdition" runat="server" TabIndex="2" MaxLength="2" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTempsMini" runat="server" Text="Temps mini d'attente"></asp:Label>
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtMini" runat="server" AutoPostBack="True" MaxLength="3" TabIndex="3"
                            OnTextChanged="txtMaxi_TextChanged" Style="width: 100%" />
                    </div>
                    <div>
                        <input type="text" id="lblErreurMini" readonly="readonly" style="border-style: hidden;
                            color: Red; height: 30px; width: 125px;" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTempsMaxi" runat="server" Text="Temps maxi d'attente"></asp:Label>
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtMaxi" runat="server" AutoPostBack="True" MaxLength="3" TabIndex="4"
                            OnTextChanged="txtMaxi_TextChanged" Style="width: 100%" />
                        <input type="text" id="lblErreurMaxi" readonly="readonly" style="border-style: hidden;
                            color: Red; height: 30px; width: 125px;" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Button ID="btnEnregistrerEntete" Text="Enregistrer" runat="server" OnClick="btnEnregistrerEntete_Click"
                        TabIndex="5" />
                    <input type="button" value="Fermer" onclick="fermerFenetre()" tabindex="6" />
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Label ID="lblErreurEntete" runat="server" Style="font-weight: 700; color: #FF0000;"></asp:Label>
                    <asp:Label ID="lblOKEntete" runat="server" Style="font-weight: 700; color: #009933;"></asp:Label>
                </div>
            </div>
        </div>
        <div id="DivLigne">
            <div style="clear: both; float: left; width: 355px; height: 391px;">
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblRang" runat="server" Text="Rang" />
                    </div>
                    <div style="float: right; width: 191px;">
                        <asp:TextBox ID="txtRang" runat="server" TabIndex="1" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTempsMiniLigne" runat="server" Text="Temps mini" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtTempsMini" runat="server" TabIndex="2" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTempsMaxiLigne" runat="server" Text="Temps maxi" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtTempsMaxi" runat="server" TabIndex="3" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblObservations" runat="server" Text="Observations" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtObservations" runat="server" TabIndex="4" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTypeOperation" runat="server" Text="Type opération" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTypeOperation" runat="server" TabIndex="5" DataSourceID="sdsTypeOpe"
                            DataTextField="LIB_TYPE_OP" DataValueField="ID_TYPE_OP" Style="width: 100%">
                        </asp:DropDownList>
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTypeBain" runat="server" Text="Type de bain" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTypeBain" runat="server" TabIndex="6" DataTextField="LIB_TYPE_BAIN"
                            DataValueField="ID_TYPE_BAIN" DataSourceID="sdsTypeBain" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTache" runat="server" Text="Tâche" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTache" runat="server" TabIndex="7" DataSourceID="sdsTache"
                            DataTextField="LIB_TACHE" DataValueField="ID_TACHE" Style="width: 100%">
                        </asp:DropDownList>
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblGroupeProgramme" runat="server" Text="Groupe programme" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlGroupePgm" runat="server" TabIndex="8" DataTextField="LIB_GROUPE_PROG"
                            DataValueField="ID_GROUPE_PROG" DataSourceID="sdsGroupePgm" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblTypeEmplacement" runat="server" Text="Type emplacement" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlTypeEmplacement" runat="server" TabIndex="9" DataSourceID="sdsTypeEmplacement"
                            DataTextField="LIB_TYPE_EMPL" DataValueField="ID_TYPE_EMPL" Style="width: 100%" />
                    </div>
                </div>
                <div style="clear: both; float: left; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblLigneReference" runat="server" Text="Ligne de référence" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="ddlIDLigneRef" runat="server" TabIndex="10" DataTextField="RANG_LIGNE_FT"
                            DataValueField="ID_LIGNE_FT" Style="width: 100%">
                            <asp:ListItem Value="-1">Sélectionner une valeur</asp:ListItem>
                        </asp:DropDownList>
                        <%--DataSourceID="sdsIDLigneRef"--%>
                        <asp:Button ID="btnActualiser" Text="..." runat="server" OnClick="btnActualiser_Click" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 354px;">
                    <br />
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Button ID="btnEnregistrerLigne" Text="Enregistrer" runat="server" OnClick="btnEnregistrerLigne_Click"
                        TabIndex="5" />
                    <input type="button" value="Fermer" onclick="fermerFenetre()" tabindex="6" />
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Label ID="lblErreurLigne" runat="server" Style="font-weight: 700; color: #FF0000;"></asp:Label>
                    <asp:Label ID="lblOKLigne" runat="server" Style="font-weight: 700; color: #009933;"></asp:Label>
                </div>
            </div>
            <div title="SqlDataSource" style="clear: both; float: left">
                <asp:SqlDataSource ID="sdsTypeOpe" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TYPE_OP, LIB_TYPE_OP FROM ADMIN.TYPE_OP ORDER BY LIB_TYPE_OP">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsTypeBain" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TYPE_BAIN, LIB_TYPE_BAIN, MSG_TYPE_BAIN FROM ADMIN.TYPE_BAIN ORDER BY LIB_TYPE_BAIN">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsTypeEmplacement" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TYPE_EMPL, LIB_TYPE_EMPL FROM ADMIN.TYPE_EMPL ORDER BY LIB_TYPE_EMPL">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsGroupePgm" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_GROUPE_PROG, LIB_GROUPE_PROG, ID_PRGDEF_GROUPE_PROG FROM ADMIN.GROUPE_PROG ORDER BY LIB_GROUPE_PROG">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsTache" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_TACHE, LIB_TACHE, ID_METIER_TACHE, ID_GROUPE_TACHE_TACHE FROM ADMIN.TACHE WHERE (ID_METIER_TACHE = 21) ORDER BY ID_TACHE">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsIDLigneRef" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                    ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_LIGNE_FT, MINI_LIGNE_FT, MAXI_LIGNE_FT, OBS_LIGNE_FT, RANG_LIGNE_FT, ID_TYPE_OP_LIGNE_FT, ID_TYPE_BAIN_LIGNE_FT, ID_TACHE_LIGNE_FT, ID_GROUPE_PROG_LIGNE_FT, ID_TYPE_EMPL_LIGNE_FT, ID_ENTETE_FT_LIGNE_FT, ID_REF_LIGNE_FT FROM ADMIN.LIGNE_FT WHERE (ID_ENTETE_FT_LIGNE_FT = :monEntete)">
                </asp:SqlDataSource>
            </div>
        </div>
        <div id="DivArticle">
            <div style="clear: both; float: left; width: 355px">
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblDate" runat="server" Text="Date de référence" Style="width: 100%" />
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:TextBox ID="txtDate" runat="server" MaxLength='20' TabIndex="5" Style="width: 100%"
                            onBlur="masqueSaisieDate(this.form.txtDate)" />
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <div style="clear: both; float: left; width: 129px;">
                        <asp:Label ID="lblArticleArticle" runat="server" Text="Article"></asp:Label>
                    </div>
                    <div style="float: right; width: 191px">
                        <asp:DropDownList ID="DdlArticle" runat="server" DataSourceID="SqlArticle" DataTextField="ID_ARTICLE"
                            DataValueField="ID_ARTICLE" OnSelectedIndexChanged="DdlArticle_SelectedIndexChanged"
                            Style="width: 100%">
                        </asp:DropDownList>
                    </div>
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Button ID="btnEnregistrerArticle" Text="Enregistrer" runat="server" TabIndex="5"
                        OnClick="btnEnregistrerArticle_Click" />
                    <input type="button" value="Fermer" onclick="fermerFenetre()" tabindex="6">
                </div>
                <div style="clear: both; float: left; height: 31px; width: 320px;">
                    <asp:Label ID="lblErreurArticle" runat="server" Style="font-weight: 700; color: #FF0000;"></asp:Label>
                    <asp:Label ID="lblOkArticle" runat="server" Style="font-weight: 700; color: #009933;"></asp:Label>
                </div>
            </div>
            <asp:SqlDataSource ID="SqlArticle" runat="server" ConnectionString="<%$ ConnectionStrings:PCCConnectionStringBDD %>"
                ProviderName="<%$ ConnectionStrings:PCCConnectionStringBDD.ProviderName %>" SelectCommand="SELECT ID_ARTICLE FROM &quot;ARTICLE&quot; ORDER BY &quot;ID_ARTICLE&quot;">
            </asp:SqlDataSource>
        </div>
        <script type="text/javascript" language="JavaScript">
            recupArguments() 
        </script>
        </form>
    </body>
    </html>

  9. #9
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    je répète ...

    C#=> coté serveur

    Html js => coté client

    fin de chargement de page = coté client le onlaod du body

    il te faudra donc retourner sur le serveur à la fin du chargement de la page
    regarde du coté d'ajax ...
    onload ou (document.ready() avec jquery)
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  10. #10
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut Javascript et code behind
    Je concois qu'il faille repartir cote serveur. mais comment?
    J'ai mis dans mon "<body>" un onload, mais ma fonction C# ne n'exécute pas.
    Je trouve pas avec Ajax comment faire ce dont j'ai besoin.

  11. #11
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Apparemment, tu ne comprends pas ce que Spaffy t'explique...

    Ton code C# est exécuté côté serveur et sert à générer un contenu HTML (+CSS et JavaScript) qu'il enverra au navigateur.
    Une fois le code envoyé, son exécution est terminée.
    Lorsque le navigateur reçoit le code HTML, il l'interprète et l'affiche.
    Donc lorsque l'interaction est possible avec l'utilisateur (donc lorsque JavaScript est exécuté), il n'existe plus de code serveur exécutable !
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  12. #12
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut
    D'accord mais comment puis je faire pour mon problème alors?

    je souhaite que ma dropdownlist (ligne 356 ID="ddlIDLigneRef") soit mise à jour à partir des infos récupèrées lors de l'ouverture de la page ('HiddenEntete'), comment puis je faire? Je souhaiterai que l'utilisateur n'ait pas à charger m"anuellement" (via un bouton) la dropdownlist.

    Merci

  13. #13
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    une requete ajax sur le onlaod
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  14. #14
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut
    Auriez vous un tuto avec exemple sur lequel me baser?

  15. #15
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    ce n'est pas ce qui manque
    http://ajax.developpez.com/cours/
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  16. #16
    Expert éminent
    Avatar de sekaijin
    Homme Profil pro
    Urbaniste
    Inscrit en
    Juillet 2004
    Messages
    4 205
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Urbaniste
    Secteur : Santé

    Informations forums :
    Inscription : Juillet 2004
    Messages : 4 205
    Points : 9 127
    Points
    9 127
    Par défaut
    Ce n'est tout de même pas compliquer que d'ouvrir sont navigateur sur la page en question de faire
    "afficher le code source"
    le copier et le coller dans le forum
    y a-t-il quelque chose que tu n e comprends pas quand on dit
    le code COTE CLIENT ?

    A+JYT

  17. #17
    Nouveau membre du Club
    Inscrit en
    Octobre 2009
    Messages
    54
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 54
    Points : 38
    Points
    38
    Par défaut
    Désolée, mais je pensais que tu voulais autre chose.
    Je connais pas bcp la techno web donc je fais avec mes moyens.
    Je suis là pour apprendre et ça peut prendre du temps des fois.

    de plus il s'agit d'une fenêtre modale et donc je n'ai pas la main pour faire "afficher le code".
    Je peux seulement le faire sur la page principale.
    Avez vous une idée de comment je pourrai faire?

  18. #18
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 056
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 056
    Points : 44 578
    Points
    44 578
    Par défaut
    Bonjour,
    Avez vous une idée de comment je pourrai faire?
    fait un simple CTR +U à l'ouverture de ta page.

Discussions similaires

  1. Appellé une fonction javascript en code behind
    Par 0xYg3n3 dans le forum ASP.NET
    Réponses: 4
    Dernier message: 17/10/2007, 15h02
  2. JavaScript en code-behind
    Par jf1985 dans le forum C#
    Réponses: 2
    Dernier message: 22/09/2007, 21h33
  3. [tout bête] JavaScript en code behind
    Par dahu17 dans le forum C#
    Réponses: 1
    Dernier message: 06/09/2007, 15h28
  4. Google Map API --> Javascript et code behind C#
    Par bridel dans le forum ASP.NET
    Réponses: 2
    Dernier message: 22/01/2007, 21h07
  5. [VB.NET]Javascript et code behind
    Par Dadou74 dans le forum ASP.NET
    Réponses: 1
    Dernier message: 17/11/2006, 16h30

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