how to Use asp.net Repeater Control

How to Use Repeater Control in asp.net :

Definition :The Repeater control, used for display a list of items that are bound to the control.
Description:  In this post we trying to learn how to use Repeater control in over asp.net web application.and how to bind repeater control from data base.here we  will explain "what is repeater control, uses of repeater control, bind data to repeater control in asp.net".

What is Repeater Control in .net?/what is repeater control in asp net with example:

The Repeater control, used for display a list of items that are bound to the control. The Repeater control can be bound to a database table(sql database), an XML file, or another list of items. Here we will show how to bind an XML file to a Repeater control.Repeater Control is a default control of .net ,which is used to display the  list of items.

Uses of Repeater Control in asp.net:

The Repeater control, used for display a list of items that are bound to the control. and it’s same as grid view and data grid view. Repeater control is lightweight and faster to display data with compared to  Grid view and Data grid view . By using this control we can display data according to the customer format but it’s not eassy  in grid view or data grid view .  
The Repeater control works on loop concept. 


  <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
                    </asp:Repeater>

code for .aspx page :

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_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>Repeator Control Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<div>
<asp:Repeater ID="RepDetails" runat="server">
<HeaderTemplate>
<table style=" border:1px solid #df5015; width:500px" cellpadding="0">
<tr style="background-color:#df5015; color:White">
<td colspan="2">
<b>Notis bord :</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:500px" >
<tr>
<td>
News :
<asp:Label ID="lblSubject" runat="server" Text='<%#Eval("Subject") %>' Font-Bold="true"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblComment" runat="server" Text='<%#Eval("Comment") %>'/>
</td>
</tr>
<tr>
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015;border-bottom:1px solid #df5015; width:500px" >
<tr>
<td>Post By: <asp:Label ID="lblUser" runat="server" Font-Bold="true" Text='<%#Eval("UserName") %>'/></td>
<td>Created Date:<asp:Label ID="lblDate" runat="server" Font-Bold="true" Text='<%#Eval("PostedDate") %>'/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>

Other Post :


  • SQL Helper Class, Example of how to add captcha in Asp.net using C#
  • Sql Query for asp.net Programming ,How to get Server IP, How to create graph in asp.net:
  • How to create Line chart in Asp.net programming:
  • How to Make Data Table By C# code in Asp.net Programming:
  • How to Print Div in Asp.net Programming by javaScript 
  • How to Calculate Number of Sunday in a particular month by asp.net programming 
  • How to Make a HTML Table by C# code in asp.net programming 
  • how to get Asp.net the First Sunday of the Given Month
  • How to calculate first date and last date of month
  • Display selected Date from data base into asp.net calendar 

Popular posts from this blog