Use Repeater or DataList?

G

Guest

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!
 
E

Eliyahu Goldin

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
 
G

Guest

Thanks Eliyahu, that worked.

Eliyahu Goldin said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top