AutoCompleteExtender not working
following is the code i am using and it is not working.
<asp:TextBox ID="txtWarrantNumb开发者_Go百科er" runat="server"></asp:TextBox>
<AjaxCtrl:AutoCompleteExtender ID="acWarrantNumber" runat="server" TargetControlID="txtWarrantNumber"
ServiceMethod="GetWarrantNumber" ShowOnlyCurrentWordInCompletionListItem="true"
CompletionInterval="100" EnableCaching="true" MinimumPrefixLength="1" CompletionSetCount="4">
</AjaxCtrl:AutoCompleteExtender>
</ContentTemplate>
</asp:UpdatePanel>
</PopupTemplate>
Public Shared Function GetWarrantNumber(ByVal prefixText As String, ByVal count As Integer) As String()
Dim warrantNumbers() As String = {"ankit", "sachin", "ankrrr", "ankppp"}
Return warrantNumbers
End Function
The function GetWarrantNumber
needs to be in a WebService as a WebMethod. And you need to provide the location of the WebService.asmx file in the ServicePath property.
AutoCompleteExtender
To do this without a webservice you need wrap your method with the following within the Page:
<script runat="server">
<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetWarrantNumber()
.....
End Function
</script>
If you do it this way then you don't need to provide a ServicePath.
精彩评论