Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am using jquery autocomplete it is working in aspx pages(without master page)
But when i wrote the code in child master page it is not working

$(document).ready(function () {
$(%=txtSearch.ClientID%>).autocomplete(SearchText.ashx);})

this my searchText.ashx code
C#
public void ProcessRequest (HttpContext context) {

       string prefixText = context.Request.QueryString["q"];
       
       
           using (SqlConnection conn = new SqlConnection())
           {
               conn.ConnectionString = ConfigurationManager
                       .ConnectionStrings["constr"].ConnectionString;
               using (SqlCommand cmd = new SqlCommand())
               {
                   cmd.CommandText = "select Particulars from M_Stock where " +
                   "Particulars like @SearchText + '%'";
                   cmd.Parameters.AddWithValue("@SearchText", prefixText);
                   cmd.Connection = conn;
                   StringBuilder sb = new StringBuilder();
                   conn.Open();
                   using (SqlDataReader sdr = cmd.ExecuteReader())
                   {
                       while (sdr.Read())
                       {
                           sb.Append(sdr["Particulars"])
                               .Append(Environment.NewLine);
                       }
                   }
                   conn.Close();
                   context.Response.Write(sb.ToString());
               }

       }
   }

   public bool IsReusable {
       get {
           return false;
       }
   }
Posted
Updated 17-Jul-13 19:48pm
v2

1 solution

check there may be error in master page
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900