Hello all - as per my other posts, excuse my ignorance, I am new to this and finding myself quite out of my depth at the moment!
Ok, I have set up a text box with an auto complete extender attached that is populated using a web service, et voila:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference InlineScript="false" Path="~/GetProd.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox ID="txtProDesSearch" AutoComplete="off" Autocompletetype="Search" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="txtProDesSearch_AutoCompleteExtender"
runat="server"
DelimiterCharacters=""
TargetControlID="txtProDesSearch"
Enabled="True"
ServiceMethod="GetProdDesSearch"
ServicePath="~/GetProd.asmx"
CompletionSetCount="10" EnableCaching="true" MinimumPrefixLength="3"
CompletionInterval="10">
</cc1:AutoCompleteExtender>
---------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
/// <summary>
/// Summary description for GetProd
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class GetProd : System.Web.Services.WebService
{
public GetProd()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetProdDesSearch(string prefixText, int count)
{
try
{
TORDataContext dbac = new TORDataContext();
return dbac.tblOnlineReportingCOMPLETEWeights
.Where(r => r.MemberId == "FM00012" && r.UnitDescription.StartsWith(prefixText))
.OrderBy(r => r.UnitDescription)
.Select(r => r.UnitDescription)
.Distinct()
.Take(count)
.ToArray();
}
catch
{
}
return null;
}
}
Now, I know the webmethod itself works as origianlly tested the functionality in a test solution...however, I can't get this version to work at all and it is driving me mad. I am assuming I have incorrectly set up the web service but I'm just a but stuck.
If someone can point me in the right direction, I would really appreciated. Again, apologies for being thick.