Grid formatting

Hi Experts,

I have DataGrid that is bound by : DataGrid1.DataBind(); command
The question is how to make odd rows white and even rows red ?
Is there built-in method for this ?

Thanks.
LVL 1
fpoyavoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dabitbolCommented:
Yeah it's the AlternateItemTemplate, just set its color to whatever you want.
0
dabitbolCommented:
Sorry it's: AlternatingItemStyle

Example:
<AlternatingItemStyle BackColor="#66FFFF"></AlternatingItemStyle>

Good Luck
0
dabitbolCommented:
Here's a bigger example:

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 116; LEFT: 624px; POSITION: absolute; TOP: 136px"
                        runat="server">
<AlternatingItemStyle BackColor="#00FFFF"></AlternatingItemStyle>
</asp:DataGrid>
0
tusharashahCommented:
Are you using VS .Net? if yes then you can do it one of the following way:

1)
Right Click Your DataGrid --> Property Builder --> Format -->  Expand Items
  --> Modify the Alternating Item

2) Use AutoFormat!
Right Click Your DataGrid --> AutoFormat --> Select any...

-tushar
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dabitbolCommented:
Ahh! Beginners! That's too bad, but it is Experts Exchange, at least the I showed you can be applied everywhere else including VS.NET
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.