Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/09/2010, 10:17
chuchufuentes
 
Fecha de Ingreso: mayo-2008
Mensajes: 353
Antigüedad: 16 años
Puntos: 3
Respuesta: por que sera dificil ajax y vs2005

Gracias claudiovega, perfecto no hay errores pero tampoco funciona escribo las letras a buscar y nada. Donde estará mi error, este es el código html

<form id="form1" runat="server">
<div>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" enabled="True"
TargetControlID="myTextBox"
servicepath="C:\Inetpub\wwwroot\WebSitex1\comple.a spx"
MinimumPrefixLength="1"
servicemethod="ObtListaIdentificacion"
CompletionInterval="1000"
EnableCaching="true"
usecontextkey="True"
CompletionSetCount="12">
</cc1:AutoCompleteExtender>

</div>
<asp:TextBox ID="myTextBox" runat="server" AutoPostBack="True"></asp:TextBox>
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
</form>

mi webform se llama comple.aspx, abajo esta código la cual llamo a una función llamada ObtListaIdentificacion.
tambien coloque esto en el webconfig
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
<add name="HttpPostLocalhost"/>
</protocols>
</webServices>


Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.Script.Services
Imports System.Collections.Generic

Partial Class comple
Inherits System.Web.UI.Page
Private cnstr As String = ConfigurationManager.ConnectionStrings("connsql"). ConnectionString
<WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Function ObtListaIdentificacion(ByVal prefixText As String, ByVal count As Integer) As String()
Dim con As New SqlConnection(cnstr)
Dim comando As New SqlCommand("select Top 10 nombrelink from links where nombrelink LIKE '%' + @param + '%' ", con)
comando.Parameters.AddWithValue("param", prefixText)
Dim dr As SqlDataReader
comando.Connection.Open()
dr = comando.ExecuteReader
Dim lista As New List(Of String)
While dr.Read
lista.Add(dr.Item("nombrelink"))
End While
comando.Connection.Close()
Return lista.ToArray
End Function
End Class


porfa una ayuda