Loading ...

Bind Repeater With ArrayList | CodeAsp.Net

Bind Repeater With ArrayList

0 (0votes)

Many times we want to bind the Repeater with ArrayList.We can use Data Source property of Repeater for binding with Array List.
Following is HTML page code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
Title="Bind Repeater With ArrayList" %>

<!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">
<form id="form1" runat="server">
<asp:Repeater ID="rptBindWithArrayList" runat="server">
<%#Container.DataItem %>

follwoing is C# Code:

protected void Page_Load(object sender, EventArgs e)
private void BindRepeater()
     ArrayList arrayList = new ArrayList();
    arrayList.Add("Vijendra Singh");
    arrayList.Add("Mohd Asif");
    arrayList.Add("Vinay Gupta");
    arrayList.Add("Sumit Arora");
    arrayList.Add("Shaitender Singh");
    rptBindWithArrayList.DataSource = arrayList;

Hope it will help..Frown


Comments (no comments yet)

  • :*
  • :*
  • :

Top Posts