Hi can anyone direct me on how to do a Seach functionalitieswithin a masterpage..
like this site: http://code.msdn.microsoft.com/vstudio
whenever i type any word in a textbox, it will show all list in result Page..
PLease HELP ME thank you so much!!
Search whole table in database
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

arjun44 pointsPosted Dec 18, 2012, 7:55 PM EST
question not clear...
1.use textchanged event for textbox
2.connect db table in textchanged event
3.use storedprocedure to get table values
4.pass textbox value to storedprocedure as parameter.
5.parameter value must be like serch
ex:
create procedure p
@p varchar(100)
as
begin
select t from tbl here t like '%@p%'
end
then u ll get result.....
mary jean ligasRank #4,658 · 330 pointsPosted Dec 18, 2012, 7:59 PM EST
arjun44 pointsPosted Dec 18, 2012, 8:03 PM EST
arjun44 pointsPosted Dec 18, 2012, 8:13 PM EST
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data.SqlClient;
using
System.Data;
public
partial class Default4 : System.Web.UI.Page
{
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
con =
new SqlConnection("Database=Admin_db_Student_Details;server=teddy;Trusted_Connection=Yes");
con.Open();
Response.Write(con.State.ToString());
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("storedprocedurename", con);
cmd.CommandType =
CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(
"@pname", TextBox1.Text);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
TextBox2.Text = dt.Rows[0][0].ToString();
}
}