Tuesday, May 28, 2013

Asp.net Repeater Control

    The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control may be bound to a database table, an XML file, or another list of items. Here we will show how to bind an XML file to a Repeater control.

    Lets explain :

    Client side --- Reapeterexample.aspx :

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Reapeterexample.aspx.cs" Inherits="Reapeterexample" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:Repeater runat="server" ID="rpt1">
                    <table border="1" style="border-collapse: collapse; font-family: Verdana; font-size: 12px;
                        width: 80%">
                        <tr style="font-size: 12px; color: White; font-weight: bold; font-family: Verdana, Helvetica, sans-serif;
                            background-color: #336699; height: 20px;">
                            <td align="center">
                                Client Code
                            <td align="center">
                                Client Name
                            <%# Eval("ClientId")%>
                            <%# Eval("ClientName")%>

    Code behind side -----
    Client side --- Reapeterexample.aspx .cs :

    protected void Page_Load(object sender, EventArgs e)
            DataTable dt = new DataTable();
            for (int i = 0; i < 10; i++)
                DataRow dr = dt.NewRow();
                dr["ClientId"] = i;
                dr["ClientName"] = "ClientName-" + i;
                rpt1.DataSource = dt;


If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website