hi,
I am using autocomplete extender, i write a webservice the webservice is working fine when i run webservice. But when i run my aspx page it is not displaying any thing the autocomplete is not showing only text box is there. this is my code......
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class WebService : System.Web.Services.WebService {
SqlConnection con;SqlDataAdapter da;
public WebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string[] GetTitleInfo(string prefixText)
{
int count = 10;
string sqry = "select * from news_upload where newstitle like @prefixText";
da = new SqlDataAdapter(sqry, "server=localhost;database=tfcnew;user id=sa;password=sql123");
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 100).Value = prefixText + "%";
DataTable dt = new DataTable();
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["newstitle"].ToString (), i);
i++;
}
return items;
}
this is (above) service.
<asp:TextBox ID="txtcomplete" runat ="Server" ></asp:TextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" MinimumPrefixLength ="1" ServiceMethod ="GetSuggestions" ServicePath="~/WebService2.asmx" TargetControlID ="txtcomplete" >
</asp:AutoCompleteExtender>
This is aspx code..
can u help me. thank you.