title: Assign values from web method to text box and hidden field
body: <p>I have written a web method for an auto complete textbox using jQuery.<br>
  I want to assign the values selected from this textbox company to textbox and enquiryid to hidden field.</p>
  
  <pre><code>[WebMethod]
  public static List&lt;string&gt; GetAutoCompleteData(string username)
  {
    //  int usr = ((int)Session["orgid"]);
    DbConnect objdbc = new DbConnect();
    SqlConnection con = objdbc.openConnection(); 
    List&lt;string&gt; result = new List&lt;string&gt;();
    using (SqlCommand cmd = new SqlCommand("select DISTINCT top 10 Company from EnquiryMaster where Company LIKE '%'+@SearchText+'%'", con))
    {
      // con.Open();
      cmd.Parameters.AddWithValue("@SearchText", username);
      SqlDataReader dr = cmd.ExecuteReader();
      while (dr.Read())
      {
        result.Add(dr["Company"].ToString());
      }
      return result;
    }
  }
  </code></pre>