gridview search functionality

Hi experts,

I have a grid view control with should be populated with what is searched for in this site. somehow can't write the search code

need assistance!!

 public void PopulateGrid()
        DataSet objDs = new DataSet();

        myConnection = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["X10REPDConnectionString"].ConnectionString);
        System.Data.SqlClient.SqlDataAdapter  myCommand;
        myCommand = new System.Data.SqlClient.SqlDataAdapter("MP_CheckStaffExists", myConnection);
        myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;

        if (objDs.Tables.Count == 0)
            lblNoRecords.Visible = true;
            GridView1.DataSource = objDs;

    public void ItemDataBoundEventHandler1(object sender, GridViewRowEventArgs e)
        if (e.Row.RowType == DataControlRowType.DataRow)
            e.Row.Attributes.Add("onmouseover", "'Silver'");
            e.Row.Attributes.Add("onmouseout", "'#FFFBD6'");
    protected void btnSearch_Click(object sender, EventArgs e)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi SirReadAlot,

You should:
 - call your PopulateGrid() method from btnSearch_Click
 - modify PopulateGrid() method to accept a few parameters; those parameters would be values from text boxes where users will type-in their search criteria
 - add input parameters (search criteria) to your stored procedure (MP_CheckStaffExists)
 - add input parameters of stored procedure to myCommand  object.

Hope this will help.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.