Search GridView data Asp.net [closed]

2

I have a GridView called grvListaFuncionario that is populated by my bank data. I'm having a problem when I search the data on it.

private void Pesquisar()
{

    DataTable table = new DataTable();
    table = grvListaFuncionarios.DataSource as DataTable;

    table.DefaultView.RowFilter = " nome like '%" + txtPesquisar.Text + "%'" +
                                       "or cargo like '%" + txtPesquisar.Text + "%'" +
                                       "or salário like '%" + txtPesquisar.Text + "%'";

    grvListaFuncionarios.DataSource = table;
    grvListaFuncionarios.DataBind();
}

The following error is returned:

  

Additional information: Object reference not set to an instance of an object.

    
asked by anonymous 28.11.2016 / 00:14

0 answers