Bonjour,

J'ai codé un aspx affichant un clavier numérique virtuel fonctionnant avec un webservice.

Si je tape les chiffres sur mon clavier numérique ca marche nickel, dés le 5ème caractère comme paramétré.

Si je fais avec la souris en clickant sur les boutons de mon clavier numérique virtuel, le champ texte affiche correctement les chiffres saisies (comme une saisie clavier) mais la requête vers le web service ne part jamais (vu avec Fiddler) et donc il ne se passe rien contrairement avec le clavier physique.

Ci dessous mon code :

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
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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 runat="server">
 <meta id="FirstCtrlID" runat="server" http-equiv="X-UA-Compatible" content="IE=9" />
    <title></title>
    <style type="text/css">
        .btns
        {
            width: 40px;
            height: 40px;
        }
        .btns_enter
        {
            height: 40px;
            width: 140px;
        }
        .btnshide
        {
            width: 0px;
            height: 0px;
            visibility: hidden;
        }
    </style>
    <script type="text/javascript">
 
        window.onload = function () {
            document.getElementById('numcompteur').focus();
        };
 
        var isItemSelected = false;
 
        //Handler for AutoCompleter OnClientItemSelected event
        function onItemSelected() 
        {
            isItemSelected = true;
        }
 
        //Handler for textbox blur event
        function checkItemSelected(txtInput) {
            if (!isItemSelected) {
                alert("Please select item from the list only");
                txtInput.focus();
            }
            else {
                //reset isItemSelected
                isItemSelected = false;
            }
        }
 
        function keypad(button) 
        {
            var the_field = document.getElementById('numcompteur');
            var the_value = button.value;
            //alert(the_value);
            switch (the_value) 
            {
                case '+/-':
                    the_field.value = Number(the_field.value) * -1;
                    break;
                default: document.getElementById("numcompteur").value += the_value;
                    break;
            }
            document.getElementById('numcompteur').focus();
            return true;
        }
 
        function KeyEnter() {
            if (!isItemSelected) {
                alert("Sélectionner un Compteur dans la Liste");
                document.getElementById('numcompteur').value = "";
                document.getElementById('numcompteur').focus();
            }
            else {
                if (document.getElementById('numcompteur').value.length < 4) {
                    document.getElementById('numcompteur').background = 'Yellow';
                    alert("Pas assez de chiffres saisies !?");
                }
                else {
                    //alert("Item Sélectionné on inser !");
                    isItemSelected = false;
                    document.getElementById('numcompteur').background = 'White';
                    __doPostBack('<%= Button3.ClientID %>', '');
                    document.getElementById('numcompteur').value = "";
                    document.getElementById('numcompteur').focus();
                    return true;
                }
            }
        }
 
    </script>
 
</head>
<body>
    <form id="form1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <table class="style1">
        <tr>
            <td>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                    <Services>
                        <asp:ServiceReference Path="~/AutoComplete.asmx" />
                    </Services>
                </asp:ScriptManager>
                <!-- Bouton caché nécessaire pour rafraichissement UpdatePanelGridView correct via JavaScript-->
                <asp:Button ID="Button3" runat="server" Text="Insert Data in GridView" OnClick="btnInsert_Click"  />
            </td>
        </tr>
        <tr>
            <td class="style2">
            </td>
        </tr>
        <tr>
            <td class="style2">
                <div id="keypad" style="float: left">
                    <div id="row1">
                        <div>
                            <div>
                                <asp:TextBox ID="numcompteur" runat="server" Height="20px" Width="136px"></asp:TextBox>
                                <asp:AutoCompleteExtender ID="autoComplete1" runat="server" TargetControlID="numcompteur"
                                    ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="5"
                                    CompletionInterval="1000" DelimiterCharacters="" Enabled="True">
                                </asp:AutoCompleteExtender>
                           </div>
                        </div>
                        <input type=button id="Key_1" value="1" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_2" value="2" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_3" value="3" onclick="keypad(this)" class="btns" />
                    </div>
                    <div id="row2">
                        <input type=button id="Key_4" value="4" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_5" value="5" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_6" value="6" onclick="keypad(this)" class="btns" />
                    </div>
                    <div id="row3">
                        <input type=button id="Key_7" value="7" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_8" value="8" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_9" value="9" onclick="keypad(this)" class="btns" />
                    </div>
                    <div id="row4">
                        <input type=button id="Key_dot" value="." onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_0" value="0" onclick="keypad(this)" class="btns" />
                        <input type=button id="Key_chgsign" value="+/-" onclick="keypad(this)" class="btns" />
                    </div>
                    <div id="row5">
                        <input id="Key_Enter" type="button" value="Entrée" onclick="KeyEnter()" class="btns_enter" />
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                    <ContentTemplate>
                        <br />
                        <asp:GridView ID="GridView1" runat="server" DataKeyNames="ASSET_ID,OMEGA_NUMPCONSO"
                            DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
                            PagerSettings-Visible="true" EnableViewState="False" CellPadding="4" ForeColor="#333333"
                            GridLines="None" PageSize="8">
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            <Columns>
                                <asp:BoundField DataField="ASSET_ID" HeaderText="Id. Boîte" ReadOnly="True" 
                                    SortExpression="ASSET_ID" Visible="False" />
                                <asp:BoundField DataField="OMEGA_NUMPCONSO" HeaderText="Num. Pt Conso" ReadOnly="True"
                                    SortExpression="OMEGA_NUMPCONSO" />
                                <asp:BoundField DataField="OMEGA_NUMSERIE" HeaderText="Num Série Cpt." SortExpression="OMEGA_NUMSERIE"
                                    ReadOnly="True" />
                                <asp:BoundField DataField="CONSO_INDEX" HeaderText="Index" SortExpression="CONSO_INDEX" />
                                <asp:CommandField ShowDeleteButton="True" ButtonType="Image" DeleteImageUrl="~/Image/ag_supprimer.png"
                                    DeleteText="" />
                            </Columns>
                            <EditRowStyle BackColor="#999999" />
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#E9E7E2" />
                            <SortedAscendingHeaderStyle BackColor="#506C8C" />
                            <SortedDescendingCellStyle BackColor="#FFFDF8" />
                            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                        </asp:GridView>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM AEP_BOITE_BRANCH_OMEGA WHERE ASSET_ID = :ASSET_ID"
                            DeleteCommand="DELETE FROM AEP_BOITE_BRANCH_OMEGA WHERE ASSET_ID = :ASSET_ID and OMEGA_NUMPCONSO = :OMEGA_NUMPCONSO">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="ASSET_ID" QueryStringField="ag_asset_id" />
                            </SelectParameters>
                            <DeleteParameters>
                                <asp:Parameter Name="ASSET_ID" />
                                <asp:Parameter Name="OMEGA_NUMPCONSO" />
                            </DeleteParameters>
                        </asp:SqlDataSource>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowCommand" />
                        <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowDeleting" />
                        <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowDeleted" />
                        <asp:AsyncPostBackTrigger ControlID="Button3" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
merci de vos conseils