Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2008, 08:17 AM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default repeator

Hi
I have an array of numbers and i want to display the array contents in a repeator control. but for some reason repeator display nothing.

Thanks

******************************************

  <asp:Repeater ID="RPTYear" runat="server">

      <ItemTemplate><%# Eval("Years")%></ItemTemplate>
    </asp:Repeater>

*********************************************

  Protected Sub RPTYear_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RPTYear.Load

        RPTYear.DataSource = LoadYears()
        RPTYear.DataBind()
    End Sub


  Public Function LoadYears() As Array

        Dim years(2) As Integer
        Dim CurrentYear As Integer

        CurrentYear = Date.Today.Year()
        years(0) = (CurrentYear) ' For 2008
        years(1) = (CurrentYear - 1) ' For 2007
        years(2) = (CurrentYear - 2) ' For 2006
        Return years

    End Function
 
Old March 27th, 2008, 03:39 AM
Authorized User
 
Join Date: Mar 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

just replace your code with this:

<ItemTemplate><%# Container.DataItem %></ItemTemplate>

this will work.












Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.