Repeater Control Using Data Show, Paging, Searching With API

Repeater Tools is a powerful control in asp.net. We have used this tool and it adjusts in any type of format, like mobile web view, so it's a powerful control to show data on websites and for searching, paging, or showing data in the main parts of every web site to cover all fields of access on it.

Details

HTML Code For index page


Output show data

output

Searching data

output

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %>  
  2.     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  3.     <html xmlns="http://www.w3.org/1999/xhtml">  
  4.   
  5.     <head id="Head1" runat="server">  
  6.         <title>All Student Records </title>  
  7.         <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css" />  
  8.         <script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>  
  9.         <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>  
  10.         <script>  
  11.             $(document).ready(function() {  
  12.                 $('#tableCustomer').dataTable();  
  13.             });  
  14.         </script>  
  15.     </head>  
  16.   
  17.     <body>  
  18.         <form id="form1" runat="server">  
  19.             <div>  
  20.                 <asp:Repeater ID="rptrCustomer" runat="server">  
  21.                     <HeaderTemplate>  
  22.                         <table id="tableCustomer" class="display">  
  23.                             <thead>  
  24.                                 <tr>  
  25.                                     <th> Title </th>  
  26.                                     <th> Name </th>  
  27.                                     <th> Designation </th>  
  28.                                     <th> Institution </th>  
  29.                                     <th> Category </th>  
  30.                                     <th> Graduate </th>  
  31.                                     <th> Telephone </th>  
  32.                                     <th> Mobile </th>  
  33.                                     <th> Email </th>  
  34.                                 </tr>  
  35.                             </thead>  
  36.                     </HeaderTemplate>  
  37.                     <ItemTemplate>  
  38.                         <tr>  
  39.                             <td>  
  40.                                 <%# DataBinder.Eval(Container.DataItem, "title")%>  
  41.                             </td>  
  42.                             <td>  
  43.                                 <%# DataBinder.Eval(Container.DataItem, "name")%>  
  44.                             </td>  
  45.                             <td>  
  46.                                 <%# DataBinder.Eval(Container.DataItem, "design")%>  
  47.                             </td>  
  48.                             <td>  
  49.                                 <%# DataBinder.Eval(Container.DataItem, "institution")%>  
  50.                             </td>  
  51.                             <td>  
  52.                                 <%# DataBinder.Eval(Container.DataItem, "category")%>  
  53.                             </td>  
  54.                             <td>  
  55.                                 <%# DataBinder.Eval(Container.DataItem, "graddmc")%>  
  56.                             </td>  
  57.                             <td>  
  58.                                 <%# DataBinder.Eval(Container.DataItem, "telephoneno")%>  
  59.                             </td>  
  60.                             <td>  
  61.                                 <%# DataBinder.Eval(Container.DataItem, "mobile")%>  
  62.                             </td>  
  63.                             <td>  
  64.                                 <%# DataBinder.Eval(Container.DataItem, "email")%>  
  65.                             </td>  
  66.                         </tr>  
  67.                     </ItemTemplate>  
  68.                     <FooterTemplate>  
  69.                         </table>  
  70.                     </FooterTemplate>  
  71.                 </asp:Repeater>  
  72.             </div>  
  73.         </form>  
  74.     </body>  
  75.   
  76.     </html> 
C# coding

  1. // its code by mukesh  
  2. //05-04-2016  
  3. using System;  
  4. using System.Collections.Generic;  
  5. using System.Linq;  
  6. using System.Web;  
  7. using System.Web.UI;  
  8. using System.Web.UI.WebControls;  
  9. using System.Data;  
  10. using System.Web.Services;  
  11. using System.Configuration;  
  12. using System.Data.SqlClient;  
  13. public partial class admin_Default: System.Web.UI.Page  
  14. {  
  15.     private int PageSize = 10;  
  16.     protected void Page_Load(object sender, EventArgs e)  
  17.     {  
  18.         string connection = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;  
  19.         SqlConnection com = new SqlConnection(connection);  
  20.         string query = "SELECT * FROM register"//Northwind DataBase  
  21.         SqlDataAdapter sda = new SqlDataAdapter(query, com);  
  22.         DataTable dtCustomers = new DataTable();  
  23.         sda.Fill(dtCustomers);  
  24.         rptrCustomer.DataSource = dtCustomers;  
  25.         rptrCustomer.DataBind();  
  26.     }  
  27. }  
web config 
  1. <connectionStrings>  
  2.     <add name="dbconnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dmcg_admin;Integrated Security=True" />   
  3. </connectionStrings>  
Data base table scripts
  1. CREATE TABLE [dbo].[register](  
  2. [id] [int] IDENTITY(1,1) NOT NULL,  
  3. [regid] [nvarchar](255) NULL,  
  4. [title] [nvarchar](255) NULL,  
  5. [name] [nvarchar](255) NULL,  
  6. [design] [nvarchar](255) NULL,  
  7. [institution] [nvarchar](255) NULL,  
  8. [category] [nvarchar](255) NULL,  
  9. [graddmc] [nvarchar](255) NULL,  
  10. [telephoneno] [nvarchar](255) NULL,  
  11. [mobile] [nvarchar](255) NULL,  
  12. [email] [nvarchar](255) NULL,  
  13. [ip] [nvarchar](255) NULL,  
  14. [date] [nvarchar](255) NULL,  
  15. [updateddate] [nvarchar](255) NULL,  
  16. [status] [nvarchar](255) NULL  
  17. ON [PRIMARY]  

 

Ebook Download
View all
Learn
View all