By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Use Repeater or DataList?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.