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