1. just bind the gridview to the sqldatasource where you can customize the type of input parameter for the query.
ex: you can pass the querystring or (ID) as the selectparameter in SqlDatasource.
2. if you are binding it through code i.e., Either Dataset or Datatable you can query it on the Page_load it reflects in the gridview.
DataTable.Select() method...
for reference view
this [
^]