In this blog we will know how to Search Records using TextBox and Display those values in GridView.
<%@
Page Language="C#"
AutoEventWireup="true"
CodeBehind="Default.aspx.cs"
Inherits="Search_Record_Display_in_GridView._Default"
%>
<!DOCTYPE
html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
>
<head
runat="server">
<title>Untitled
Page</title>
</head>
<body>
<form
id="form1"
runat="server">
<div>
<asp:Label
ID="Label7"
runat="server"
Text="Search By Name"></asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1"
runat="server"
ErrorMessage="Please
insert name" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:GridView
ID="GridView1"
runat="server">
</asp:GridView>
<asp:Button
ID="btn_search"
runat="server"
Text="Search"
onclick="btn_search_Click"
/><br
/>
<asp:Label
ID="lblmsg"
runat="server"
BackColor="#FFFF66"
Font-Bold="True"
ForeColor="#FF3300"></asp:Label>
</div>
</form>
</body>
</html>

Join the conversation! Your thoughts help the community grow.