hide column from a datagrid + change rows colors

Posted on 2006-04-14
Last Modified: 2010-04-23
i need to hide a column from a datagrid.
the datagrid source is a table from the dataset


i need to change the color of the rows in this grid, say fst one is blue second white third blue fourth white....

what is the simpler way to do it...
Question by:mte01
    LVL 5

    Accepted Solution

    try this for the column

    and for the alternating colors
    use the AlternatingBackColor property of the datagrid  ala

    DataGrid1.AlternatingBackColor = Yellow
    DataGrid1.BackColor = White

    LVL 10

    Expert Comment

    to hide columns, use:
    DataGrid.Columns(columnnumber).Visible = False

    to change the colors you'll need to add this to html view of your datagrid:
    <AlternatingItemStyle BackColor="Blue" ForeColor="White" ></AlternatingItemStyle>
    LVL 3

    Author Comment

    Hi aki4u
    im talking about the's datagrid DataGrid.Columns(columnnumber).Visible = False didnt compile
    razorback041 methods worked just fine,
    thanks for the help anyway aki4u


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of convertingā€¦
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    761 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

    7 Experts available now in Live!

    Get 1:1 Help Now