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!!
Loading

arjunPosted Dec 19, 2012, 1:13 AM
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();
}
}
arjunPosted Dec 19, 2012, 1:03 AM
mary jean ligasPosted Dec 19, 2012, 12:59 AM
arjunPosted Dec 19, 2012, 12:55 AM
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.....