SiteMap  | About    

How to Repeater

The ASP.NET Repeater is a basic container control that allows you to create custom lists from any data available to the page. It provides a highly customizable interface. It has no built-in layout or styles, so you must explicitly declare all layout, formatting, and style tags within the controls templates. Every Repeater control requires minimum an ItemTemplate.


<asp:Repeater id="repeater1" runat="server" >
	<%# DataBinder.Eval(Container.DataItem, "stor_id")%>


The Repeater control that render HTML to display the contents of a list or data source to which they are bound. If the Repeater controls data source is set but no data is returned, the control renders with no items. If the data source is Nothing, the Repeater is not rendered. The following ASP.NET program shows how to display data using a Repeater Control.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head id="Head1" runat="server">
<title>Untitled Page</title>
	<form id="form1" runat="server">
		<asp:Repeater id="repeater1" runat="server" DataSourceID="SqlDataSource1">
			<%# DataBinder.Eval(Container.DataItem, "stor_id")%> &nbsp;&nbsp;
			<%# DataBinder.Eval(Container.DataItem, "stor_name")%> <br />
		<asp:SqlDataSource ID="SqlDataSource1" runat="server"
		ConnectionString="<%$ ConnectionStrings:SQLDbConnection %>"
		SelectCommand="select [stor_id],[stor_name] from stores" />
</html> (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.