how to filter a alphanumeric value using ajax autocompleteEx

Sep 6 2014 2:51 AM
 my code is...............

at .cs

  [System.Web.Script.Services.ScriptMethod()]
  [System.Web.Services.WebMethod]
  public static List<string> GetProduct(string prefixText)
  {
  OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["LensShop"].ConnectionString);
  con.Open();
  OleDbCommand cmd = new OleDbCommand("select * from SKUgen where SKU_Name like @Name+'%'", con);
  cmd.Parameters.AddWithValue("@Name", prefixText);
  OleDbDataAdapter da = new OleDbDataAdapter(cmd);
  DataTable dt = new DataTable();
  da.Fill(dt);
  List<string> SKU_Name = new List<string>();
  for (int i = 0; i < dt.Rows.Count; i++)
  {
  SKU_Name.Add(dt.Rows[i][1].ToString());
  }
  return SKU_Name;
  }



at .aspx

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<style type="text/css">
 
.productList
{
 
  margin: 0px; 
  padding: 0px; 
  height: 200px; 
  overflow:auto;
 
  }
 
</style>


  <asp:ToolkitScriptManager ID="toolSmPurchase" runat="server">
  </asp:ToolkitScriptManager>


 <asp:TextBox ID="txtPurProName" runat="server" AutoPostBack="true" Width="220px" ontextchanged="txtPurProName_TextChanged"
  ></asp:TextBox><b  style="font-size:medium; color:Red"> *</b>
  <asp:AutoCompleteExtender ID="AutoCompleteExtender1"  DelimiterCharacters=" ;"  CompletionListCssClass="productList"  EnableViewState="true" Enabled="true" TargetControlID="txtPurProName" MinimumPrefixLength="1" EnableCaching="true" CompletionInterval="1000" CompletionSetCount="1" ServiceMethod="GetProduct" runat="server">
  </asp:AutoCompleteExtender>


string value::Cri-Pol  -2.25/-0.50  Ax 80 Ad -0.65

this code is working fine. but it going to stop with space character
when i typed "Cri-pol" it return values but after typing "space" Key or any numeric values, all values going to disapeare .....


Answers (1)