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
Searching data
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_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 id="Head1" runat="server">
- <title>All Student Records </title>
- <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css" />
- <script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
- <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
- <script>
- $(document).ready(function() {
- $('#tableCustomer').dataTable();
- });
- </script>
- </head>
-
- <body>
- <form id="form1" runat="server">
- <div>
- <asp:Repeater ID="rptrCustomer" runat="server">
- <HeaderTemplate>
- <table id="tableCustomer" class="display">
- <thead>
- <tr>
- <th> Title </th>
- <th> Name </th>
- <th> Designation </th>
- <th> Institution </th>
- <th> Category </th>
- <th> Graduate </th>
- <th> Telephone </th>
- <th> Mobile </th>
- <th> Email </th>
- </tr>
- </thead>
- </HeaderTemplate>
- <ItemTemplate>
- <tr>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "title")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "name")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "design")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "institution")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "category")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "graddmc")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "telephoneno")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "mobile")%>
- </td>
- <td>
- <%# DataBinder.Eval(Container.DataItem, "email")%>
- </td>
- </tr>
- </ItemTemplate>
- <FooterTemplate>
- </table>
- </FooterTemplate>
- </asp:Repeater>
- </div>
- </form>
- </body>
-
- </html>
C# coding
-
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Web.Services;
- using System.Configuration;
- using System.Data.SqlClient;
- public partial class admin_Default: System.Web.UI.Page
- {
- private int PageSize = 10;
- protected void Page_Load(object sender, EventArgs e)
- {
- string connection = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
- SqlConnection com = new SqlConnection(connection);
- string query = "SELECT * FROM register";
- SqlDataAdapter sda = new SqlDataAdapter(query, com);
- DataTable dtCustomers = new DataTable();
- sda.Fill(dtCustomers);
- rptrCustomer.DataSource = dtCustomers;
- rptrCustomer.DataBind();
- }
- }
web config
- <connectionStrings>
- <add name="dbconnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dmcg_admin;Integrated Security=True" />
- </connectionStrings>
Data base table scripts
- CREATE TABLE [dbo].[register](
- [id] [int] IDENTITY(1,1) NOT NULL,
- [regid] [nvarchar](255) NULL,
- [title] [nvarchar](255) NULL,
- [name] [nvarchar](255) NULL,
- [design] [nvarchar](255) NULL,
- [institution] [nvarchar](255) NULL,
- [category] [nvarchar](255) NULL,
- [graddmc] [nvarchar](255) NULL,
- [telephoneno] [nvarchar](255) NULL,
- [mobile] [nvarchar](255) NULL,
- [email] [nvarchar](255) NULL,
- [ip] [nvarchar](255) NULL,
- [date] [nvarchar](255) NULL,
- [updateddate] [nvarchar](255) NULL,
- [status] [nvarchar](255) NULL
- ) ON [PRIMARY]