Gurpreet Arora

Gurpreet Arora

  • 203
  • 9.5k
  • 671.7k

Gridview

Apr 11 2015 7:04 AM
Hy

I want to Search data in gridview using textbox, I retrieve data in gridview like this

Here the Code
<asp:HiddenField ID="Employee_Id_Hidden_Field" runat="server" />      <div class="row">         <div class="col-lg-12">             <div class="panel panel-default">                 <div class="panel-heading">                     <h4>                       <span class="icon16 icomoon-icon-equalizer-2"></span>                       <span>Search Employee</span>                   </h4>                   <a href="#" class="minimize">Minimize</a>               </div>               <div class="panel-body">                        <div class="col-lg-3">                       <div class="input-group">                             <asp:TextBox ID="Employee_Id_TextBox" runat="server" placeholder="Enter Employee Id" CssClass="form-control"></asp:TextBox>                       </div>                       <!-- input-group -->                   </div>                      <div class="col-lg-3">                       <div class="input-group">                           <asp:TextBox ID="Employee_Name_TextBox" runat="server" placeholder="Enter Employee Name" CssClass="form-control"></asp:TextBox>                         </div>                       <!-- /input-group -->                   </div>                      <div class="col-lg-2">                       <asp:Button ID="Search_Button" CssClass="btn btn-default" runat="server" Text="Search" />                   </div>               </div>             </div>           <!-- End .panel -->         </div>       <!-- End .col-lg-12 -->     </div>     <!-- End .row -->   <div class="col-lg-12">       <div class="panel panel-default">           <div class="panel-heading">               <h4>                   <span class="icon16 icomoon-icon-equalizer-2"></span>                   <span>List Of Employees </span>               </h4>               <a href="#" class="minimize">Minimize</a>           </div>           <div class="panel-body noPad">               <asp:GridView ID="GridView1" Width="100%" PageSize="10" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="Employee_Id" DataSourceID="List_Employee" ForeColor="#333333" GridLines="None">                   <AlternatingRowStyle BackColor="White" ForeColor="#284775" />                   <Columns>                       <asp:BoundField DataField="Employee_Id" HeaderText="Id" ReadOnly="True" SortExpression="Employee_Id" />                       <asp:BoundField DataField="Employee_Full_Name" HeaderText="Name" SortExpression="Employee_Full_Name" />                       <asp:BoundField DataField="Employee_Fathers_Name" HeaderText="Fathers Name" SortExpression="Employee_Fathers_Name" />                       <asp:BoundField DataField="Employee_Phone_Number" HeaderText="Phone Number" SortExpression="Employee_Phone_Number" />                       <asp:BoundField DataField="Employee_Designation_ID" HeaderText="Designation ID" SortExpression="Employee_Designation_ID" />                       <asp:BoundField DataField="Created_by_Employee_Id" HeaderText="Added By" SortExpression="Created_by_Employee_Id" />                   <asp:TemplateField HeaderText="View">                           <ItemTemplate>                               <asp:LinkButton runat="server" ID="View_Detail" CommandArgument='<%#Eval("Employee_Id") %>' CommandName="View" OnClick="View_Detail_Click">View Detail</asp:LinkButton>                           </ItemTemplate>                       </asp:TemplateField>                         </Columns>                   <EditRowStyle BackColor="#999999" />                   <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />                   <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />                   <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />                   <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />                   <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />                   <SortedAscendingCellStyle BackColor="#E9E7E2" />                   <SortedAscendingHeaderStyle BackColor="#506C8C" />                   <SortedDescendingCellStyle BackColor="#FFFDF8" />                   <SortedDescendingHeaderStyle BackColor="#6F8DAE" />               </asp:GridView>                <asp:SqlDataSource ID="List_Employee" runat="server" ConnectionString="<%$ ConnectionStrings:CMMS_Standard %>" ProviderName="<%$ ConnectionStrings:CMMS_Standard.ProviderName %>" SelectCommand="SELECT [Employee_Id], [Employee_Full_Name], [Employee_Fathers_Name], [Employee_Phone_Number], [Employee_Designation_ID], [Created_by_Employee_Id] FROM [Employee_Details]"></asp:SqlDataSource>                </div>           <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />       </div>     </div>
 
now How i code to search data in gridview .

Answers (1)