473,322 Members | 1,610 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,322 software developers and data experts.

Use Repeater or DataList?

I'm trying to display a table of my company's departments in a 3 column
format with alternating row colors. The department names are being pulled
from a database in alphabetical order. I want to order the depts in
alphabetical order going from left to right in columns of 3 like:

DeptA DeptB DeptC -- light colored row
DeptD DeptE DeptF -- dark colored row

I've figured out how to get the Depts. to display in the order I need them
to using a DataList, but I'm having trouble getting the rows to alternate
colors. Can I get the DataList to do what I need to or am I better off
looking into using a Repeater?

Any advice/code samples are appreciated. Thanks!
Nov 19 '05 #1
2 1676
Keep using datalist. For setting color, use PreRender event and don't use
AlternatingItemStyle. In the event handler loop through all data items of
the datalist and set alternative color for every 3 items.

Eliyahu

"Scott" <Sc***@discussions.microsoft.com> wrote in message
news:7E**********************************@microsof t.com...
I'm trying to display a table of my company's departments in a 3 column
format with alternating row colors. The department names are being pulled
from a database in alphabetical order. I want to order the depts in
alphabetical order going from left to right in columns of 3 like:

DeptA DeptB DeptC -- light colored row
DeptD DeptE DeptF -- dark colored row

I've figured out how to get the Depts. to display in the order I need them
to using a DataList, but I'm having trouble getting the rows to alternate
colors. Can I get the DataList to do what I need to or am I better off
looking into using a Repeater?

Any advice/code samples are appreciated. Thanks!

Nov 19 '05 #2
Thanks Eliyahu, that worked.

"Eliyahu Goldin" wrote:
Keep using datalist. For setting color, use PreRender event and don't use
AlternatingItemStyle. In the event handler loop through all data items of
the datalist and set alternative color for every 3 items.

Eliyahu

"Scott" <Sc***@discussions.microsoft.com> wrote in message
news:7E**********************************@microsof t.com...
I'm trying to display a table of my company's departments in a 3 column
format with alternating row colors. The department names are being pulled
from a database in alphabetical order. I want to order the depts in
alphabetical order going from left to right in columns of 3 like:

DeptA DeptB DeptC -- light colored row
DeptD DeptE DeptF -- dark colored row

I've figured out how to get the Depts. to display in the order I need them
to using a DataList, but I'm having trouble getting the rows to alternate
colors. Can I get the DataList to do what I need to or am I better off
looking into using a Repeater?

Any advice/code samples are appreciated. Thanks!


Nov 19 '05 #3

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

Similar topics

3
by: Fredrik Rodin | last post by:
All, I'm looking for a way of generating a grouping in a repeater (or other control). Instaed of describing everything here, just look at this link and you can see how I did it in classic asp...
0
by: Shun Duke | last post by:
I have working code allowing me to nest repeaters inside datalists using relations and child rows but this does not allow me to acheive my goal. What I want to be able to do is display small...
1
by: Hans Merkl | last post by:
Hi, I must be missing something here. In a DataList and DataGrid I can use the property DataKeys to identify the selected element and get to its values. But I can't find a way to do the same in...
3
by: GD | last post by:
I'm using a DataList and a Repeater (nested in the DataList) to display a list of "Chapters" and "Documents" within the Chapters. <asp:DataList ID="dlChapter" Runat="server" RepeatColumns="2"...
7
by: Doug Parker | last post by:
I'm trying to use the repeater control to create a column-like row of data, I've searched the net and it doesn't appear to be that easy. Use this page for reference: ...
2
by: Steve | last post by:
I am having issues adding a new row in my repeater when my repeater's table cells reach a certain number. what i'm doing is adding a predetermined number of color cells from the database and...
0
by: warren_rapson | last post by:
Hi all, I am a newbie to this awesome framework - i love it. My situation: - I have a master page with a menu on it and a ContenPlaceHolder containing a DataList - The menu is dynamic and is...
2
by: mj.redfox.mj | last post by:
Hi, I wonder if someone could possibly help with this? I have the following code, which is a nested repeater in turn nesting a datalist. This all works fine, together with my page-behind vb code...
2
by: Paulo | last post by:
What is DetailsView, FormView, DataList, Repeater components? Any differences? VS 2005 asp.net C#
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.