I want to bind a textbox with a field of DB by using JQuery Code, but I don't know what parameter I can use in AutoComplete function

    $(function () {
        var availableTags = [??????];
        $("#txtSearch").autocomplete({
            source: availableTags });
  });

behind code

public partial class MasterProfile : System.Web.UI.MasterPage
{
SqlConnection cnn = new     SqlConnection(ConfigurationManager.AppSettings["dbpath"]);

protected void txtSearch_TextChanged(object sender, EventArgs e)
{
   FindFriends();
}

void FindFriends()
{
    SqlDataReader dr;
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = cnn;
    cmd.CommandText = "Select * From tblUser where UInfo Like @P1 and UID<> @P2 Order by UInfo";
    cmd.Parameters.AddWithValue("@P1", "%" + txtSearch.Text + "%");
    cmd.Parameters.AddWithValue("@P2", Convert.ToInt64(Session["ud"]));
    cnn.Open();

    dr = cmd.ExecuteReader();
    txtSearch.Text = dr["UInfo"].ToString();
    txtSearch.DataBind();
    cnn.Close();
}

}

Related posts

Recent Viewed