column wise search engin in gridview using asp net
column wise search engin in gridview using asp net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Iftikar HussainPosted Aug 27, 2013, 7:18 AM
Regards,
Iftikar
KRayudu VPosted Aug 27, 2013, 7:14 AM
protectedvoidPage_Load(objectsender, EventArgs e)02{03if(!IsPostBack)04{05BindGrid();06}07}08privateDataTable GetRecords()09{10SqlConnection conn =newSqlConnection(strConnection);11conn.Open();12SqlCommand cmd =newSqlCommand();13cmd.Connection = conn;14cmd.CommandType = CommandType.Text;15cmd.CommandText ="Select * from Employees";16SqlDataAdapter dAdapter =newSqlDataAdapter();17dAdapter.SelectCommand = cmd;18DataSet objDs =newDataSet();19dAdapter.Fill(objDs);20returnobjDs.Tables[0];2122}23privatevoidBindGrid()24{25DataTable dt = GetRecords();26if(dt.Rows.Count > 0)27{28grdSearch.DataSource = dt;29grdSearch.DataBind();30}31}Iftikar HussainPosted Aug 27, 2013, 6:33 AM
KRayudu VPosted Aug 27, 2013, 6:31 AM
i done with data bind in gridview for that i have to implement search records column wise(EX:Suppose my field name is CITY, and i have records like Bangalore,Hyderabad,Chennai,Maysore)if i enter B in textbox it has to search B in that column.i does not search from other columns(SPECFIC COLUMN RECORDS)
KRayudu VPosted Aug 27, 2013, 6:31 AM
i done with data bind in gridview for that i have to implement search records column wise(EX:Suppose my field name is CITY, and i have records like Bangalore,Hyderabad,Chennai,Maysore)if i enter B in textbox it has to search B in that column.i does not search from other columns(SPECFIC COLUMN RECORDS)
Iftikar HussainPosted Aug 27, 2013, 6:18 AM
First create a procedure like below
then in your code
GrdiView1.DataSource=dt;
GrdiView1.DataBind()
Regards,
Iftikar
KRayudu VPosted Aug 27, 2013, 5:19 AM
for example in gridview we have columns like
textbox1 textbox2 textbox3
Name Address ID
suppose if we type A in textbox1 for that particular Column(Name) data has to search. the same way,it has to search each and every column in gridview
Sanjeeb LenkaPosted Aug 27, 2013, 5:12 AM
can you plz provide more details.