hi every one am coming back again here for that i need your help
i have data in a datalist view and i want to put a textbox above that datalist view so that if the use type for search something in that datalist view the datalist will display what he want in that datalist view if it is available . THANKS SO MUCH
Search in asp.net values in a datalist view
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 5, 2013, 10:07 AM EDT
private void BindData()
{
SqlConnection Con = new SqlConnection("your connectionstring");
if(textbox1.Text==string.Empty)
SqlCommand cmd = new SqlCommand("select * from Depttable ", con);
else
SqlCommand cmd = new SqlCommand("select * from Depttable where id= '" + textBox1.Text + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
dtalist1.DataSource = ds;
dtalist1.DataBind();
}
then call this method in your search button click event
this is a sample code if any doubt reply
modeste modeste28 reputationPosted Jul 5, 2013, 11:15 AM EDT