Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Repeater: Items.count in ItemDataBound Event

Reply
Thread Tools

Repeater: Items.count in ItemDataBound Event

 
 
Josh Daws
Guest
Posts: n/a
 
      01-16-2004
Hi,

I'm just learning asp.net. I'm very familiar with asp and coldfusion, but
I'm getting very frustrated learning asp.net. I'm working on my first
project. Basically just converting a coldfusion site to asp.net

Here's what I need to do. I have a repeater that is displaying a list of
records from the db. I need the first item and the last item displayed to
be designated as first and last. Is this possible? I know I can use
e.item.itemIndex for the current record so that takes care of the first
record, but how can I tell when the item is the last item of the repeater?

Thanks.

--

Josh Daws
428 Productions, Inc.
(770) 867-8517
www.428Productions.com

Visit www.TwoBySea.net for creative gift ideas!




 
Reply With Quote
 
 
 
 
Ather Ali Shaikh
Guest
Posts: n/a
 
      01-17-2004
you can use this line

myRepeater.Items.Count

it is a zero based indexing

that your last item will be at "Count - 1"

Regards
Ather Ali Shaikh

"Josh Daws" <(E-Mail Removed)> wrote in message news:YjXNb.2229$(E-Mail Removed)...
> Hi,
>
> I'm just learning asp.net. I'm very familiar with asp and coldfusion, but
> I'm getting very frustrated learning asp.net. I'm working on my first
> project. Basically just converting a coldfusion site to asp.net
>
> Here's what I need to do. I have a repeater that is displaying a list of
> records from the db. I need the first item and the last item displayed to
> be designated as first and last. Is this possible? I know I can use
> e.item.itemIndex for the current record so that takes care of the first
> record, but how can I tell when the item is the last item of the repeater?
>
> Thanks.
>
> --
>
> Josh Daws
> 428 Productions, Inc.
> (770) 867-8517
> www.428Productions.com
>
> Visit www.TwoBySea.net for creative gift ideas!
>
>
>
>


 
Reply With Quote
 
 
 
 
Claes Claes is offline
Junior Member
Join Date: Sep 2006
Posts: 1
 
      09-11-2006
You can also try something like this:

if (e.Item.ItemIndex == ((ProductCollection)rptProducts.DataSource).Count-1)
//here you can do something with the last item


In other words: you can always check the size of the DataSource that you are binding to the repeater, and that way find out the last item in the repeater.


///Claes
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GV Databound Event vs DG ItemDataBound Event GaryDean ASP .Net 1 08-18-2006 03:47 AM
Highlight datalist row on itemDataBound event =?Utf-8?B?Q2hyaXMgRmluaw==?= ASP .Net 1 08-09-2006 06:07 PM
ItemDataBound Event - How to access the previous record when this event is raised in DataGrid? NH ASP .Net Datagrid Control 2 12-17-2004 03:58 PM
ItemDataBound event of DataGrid Dave ASP .Net 2 10-07-2004 02:54 PM
ref dropdownlist in itemdatabound event? Tina ASP .Net 1 10-14-2003 06:33 PM



Advertisments