user1661171
user1661171

Reputation: 45

While typing text in Textbox, I need to get search content using AJAX

How can I display search result while typing on the Textbox using Ajax with jQuery?

Upvotes: 0

Views: 1769

Answers (4)

Shrv11
Shrv11

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

Aristos
Aristos

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

agaonsindhe
agaonsindhe

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

Claudio Redi
Claudio Redi

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

Related Questions