Solved

Grid formatting

Posted on 2004-11-02
253 Views
Last Modified: 2010-04-15
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.
0
Question by:fpoyavo
    5 Comments
     
    LVL 3

    Expert Comment

    by:dabitbol
    Yeah it's the AlternateItemTemplate, just set its color to whatever you want.
    0
     
    LVL 3

    Expert Comment

    by:dabitbol
    Sorry it's: AlternatingItemStyle

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

    Good Luck
    0
     
    LVL 3

    Expert Comment

    by:dabitbol
    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
     
    LVL 18

    Accepted Solution

    by:
    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
     
    LVL 3

    Expert Comment

    by:dabitbol
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    3 Experts available now in Live!

    Get 1:1 Help Now