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
|
<script type="text/javascript">
function search(sender, e) {
if (e == null) {
window.location = "/test.aspx?id=1&search=" + document.getElementById('tbox').value;
//if (navigator.appName != "Microsoft Internet Explorer") CancelEvent(event);
}
else if (!isNaN(e._value) && e != null) {
document.getElementById('HiddenField1').value = e._value;
window.location = "/test.aspx?id=2&search=" + document.getElementById('HiddenField1').value;
//if (navigator.appName != "Microsoft Internet Explorer") CancelEvent(event);
}
}
function CancelEvent(e) {
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
e.stopImmediatePropagation();
return false;
}
if (window.event) {
window.event.cancelBubble = true;
window.event.returnValue = false;
return;
}
}
</script>
<asp:TextBox ID="tbox" runat="server" Width="400px" onkeypress="if(event.keyCode==13){search(event);return false;}" ClientIDMode="Static" ></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender
ID="ace"
runat="server"
TargetControlID="tbox"
ServicePath="TestAutoCompletion2.asmx"
ServiceMethod="GetCompletionNom"
MinimumPrefixLength="2"
CompletionInterval="50"
EnableCaching="true"
CompletionSetCount="10"
CompletionListCssClass = "ace_Liste"
CompletionListItemCssClass = "ace_ListeItems"
CompletionListHighlightedItemCssClass = "ace_HighlightedListItem"
OnClientItemSelected = "search">
</ajaxToolkit:AutoCompleteExtender> |
Partager