Create a table with following columns
Id(int,primary and Identity)
Name(varchar(50))
Address (varchar(50)
Email (varchar(50)
Insert some values to this table
and create a asp.net like follows
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
Search
</td>
<td>
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
</td>
<td>
<asp:button id="Button1" runat="server" text="Go" onclick="Button1_Click" xmlns:asp="#unknown" />
</td>
</tr>
</table>
<table><tr><td><p><asp:label id="Label2" runat="server" text="label" xmlns:asp="#unknown"></asp:label> </p></td></tr></table>
<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
</asp:gridview>
</div>
</form>
To Bind the grid write following method
private void BindGrid()
{
string con=ConfigurationManager.
ConnectionStrings["connectionStringName"].ConnectionString;
string query="select *from emp where Name like'"+TextBox1.Text+"%'";
SqlDataAdapter da= new SqlDataAdapter(query,con);
DataSet ds=new DataSet();
da.Fill(ds);
GridView1.Datasorce=ds;
GridView1.DataBind();
}
Then double-click on the "Go" button and use the following code:
if(dr.HasRows)
{
dr.read();
BindGrid();
GridView1.Visible=true;
TextBox1.Text="";
Label1.Text="";
}
else
{
GridView1.Visible=false;
Label1.Visible=true;
Label1.Text="The Search Term"+TextBox1.Text+ Is Not Available in The Records";
}