Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > How to bind list view on textbox changes

Not answered How to bind list view on textbox changes

Feed from this thread
  • Dharmesh avatar

    Posted on Jan 18, 2012 (permalink)

    hello,

     i want bind the listview on textbox change 

    i mean when i type any word then listview bind data from my database and refresh on next world on textbox when i type

    i am not get any help 
    so please tell me some idea or code 

    thanks

    Reply

  • Posted on Jan 19, 2012 (permalink)

    Hello,

    Try the following code snippet to bind ListView on TextBox change.
    C#:
    protected void txt_TextChanged(object sender, EventArgs e)
       {
           TextBox txt = (TextBox)sender;
           string t = txt.Text;
           int t1 = Convert.ToInt16(t);
           SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ToString());
           String s = "select FirstName,EmployeeID from Employees where EmployeeID='"+t1+"'";
           con.Open();
           SqlDataAdapter dr = new SqlDataAdapter(s, con);
           DataTable dt = new DataTable();
           dr.Fill(dt);
           con.Close();
           RadListView lst = (RadListView)txt.FindControl("ListBox1");
           lst.DataSource = dt;
           lst.DataBind();
       }

    Thanks,
    Princy.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > How to bind list view on textbox changes
Related resources for "How to bind list view on textbox changes"

ASP.NET ListView Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]