Reputation: 45
How can I display search result while typing on the Textbox using Ajax with jQuery?
Upvotes: 0
Views: 1769
Reputation: 17
it'll normally works-
protected void TextBox7_TextChanged(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from TableTest where Name like('" + TextBox7.Text + "%')";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
// GridView1.DataSource = dt;
con.Close();
}
Upvotes: 0
Reputation: 66641
I suggest this code of auto-complete.
http://www.devbridge.com/projects/autocomplete/jquery
It work with jQuery but is a small code that is not require so many extras javascript files to run, and also is highlight the words as you type.
Upvotes: 0
Reputation: 594
Even i am beginner in ajax field yesterday i tried something...found on some website after googling i cud fetch this after ...
http://jqueryui.com/autocomplete/
just go through this if not i will give you my code...
Upvotes: 0
Reputation: 68400
jquery autocomplete could be a good option for you.
It's not enough with jquery and you'll need to add the jqueryui library but you may be using more features from this library sooner than later.
Upvotes: 2