If you have any text box and you want to filter the record and display only selected record,
<asp:gridview id="GridView1" runat="server" datasourceid="SqlDataSource1" autogeneratecolumns="False">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:BoundField DataField="SecondName" HeaderText="SecondName"
SortExpression="SecondName" />
<asp:BoundField DataField="ThirdName" HeaderText="ThirdName"
SortExpression="ThirdName" />
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID"
SortExpression="EmployeeID" />
</Columns>
</asp:gridview>
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:ConnectionString %>"
selectcommand="SELECT [FirstName], [SecondName], [ThirdName], [EmployeeID] FROM [Users] WHERE ([EmployeeID] = @EmployeeID)">
<SelectParameters>
<asp:ControlParameter ControlID="txtEmpID" Name="EmployeeID"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:sqldatasource>
In .CS file you can add
protected void btnShow_Click(object sender, EventArgs e)
{
ParameterCollection prm = SqlDataSource1.SelectParameters;
prm[0].DefaultValue = txtEmpID.Text;
}
Once you enter the number and hit the show button data will display in grid.