473,385 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

autonumber line in a repeater ?

TJS
any suggestions on how to autonumber lines in a repeater ?

Nov 19 '05 #1
3 1927
Lee

Hi ;)

You could use the ItemDataBound event, which will fire once for each item
bound to the repeater, then just modify the item to include some
representation of the counter.

You could use a private field in the page class to hold the counter, reset
it to your initial value prior to calling DataBind then within the
ItemDataBound event, use the counter value and increment it.


"TJS" <no****@here.com> wrote in news:OceXHuaYFHA.2076
@TK2MSFTNGP15.phx.gbl:
any suggestions on how to autonumber lines in a repeater ?


Nov 19 '05 #2
This will certainly work. Only one comment. PreRender event suits the task
better since the repeater is fully build at this stage and you just loop
through the items.

Eliyahu

"Lee" <no***************@hotmail.com> wrote in message
news:Xn**********************************@195.129. 110.130...

Hi ;)

You could use the ItemDataBound event, which will fire once for each item
bound to the repeater, then just modify the item to include some
representation of the counter.

You could use a private field in the page class to hold the counter, reset
it to your initial value prior to calling DataBind then within the
ItemDataBound event, use the counter value and increment it.


"TJS" <no****@here.com> wrote in news:OceXHuaYFHA.2076
@TK2MSFTNGP15.phx.gbl:
any suggestions on how to autonumber lines in a repeater ?

Nov 19 '05 #3
TJS
not having much success here.
value displayed always equals total count instead of incremental step of 1
====================code======================
Dim vItemNumber As Integer = 0
......
Sub AutoNumber(o As Object, e As RepeaterItemEventArgs)
vItemNumber += 1
End Sub
.....

<asp:repeater id="items" runat="server" OnItemDataBound ="AutoNumber">

......

<ItemTemplate>
<tr class="rowcolor">
<td><%= vItemNumber %></td>
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Lee C. | last post by:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and...
35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
26
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
8
by: mathilda | last post by:
I have a situation where I need to put back in a deleted record to a table whose primary key is an Autonumber. And of course the autonumber has to match what it was before. Any way of saving my...
4
by: dhcomcast | last post by:
We're starting to use Oracle for the back-end instead of a separate Access .mdb file for the data and everything as gone surprisingly well so far. We are learning Oracle as we go; Yikes! But we...
3
by: Sandy | last post by:
Hello - I need a line between a datagrid and a repeater control that are inside a panel. I tried using <hr> but VS keeps removing the "/>" from the end of the line and then complains that it is...
3
by: M_at | last post by:
I'm using a repeater with some conditional code - one of the things I need to do is display the first X items slightly differently. To enable this I have a public integer "county" and I use it as...
0
by: erin.sebastian | last post by:
Hello All ( I posted this on another group and was directed to post this here so here goes) I am writing a webpage in c+ .net and i have a repeater that displays information, i want to add a...
3
by: PNY | last post by:
Hi all, I've made a form where it lists records sorted by their associated autonumber ID. The last line of this form displays a blank line with "AutoNumber" shown in its respective cell as if to...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.