DataGrid Cell Problem

Discussion in 'ASP .Net Datagrid Control' started by Larry Dodd, Aug 15, 2003.

  1. Larry Dodd

    Larry Dodd Guest

    I want to be able to change some properties of certain cells on the
    datagrid. For instance, let's say the datagrid has 10 rows and 5 columns. I
    want the first five rows to be normal but on the 6th through 10th row. I was
    the first two columns to have a background in the cell that is gray.

    Even better would be to have the first two columns on the 6th through 10th
    row to span two columns. I have included a small example below. Any help on
    either of these problems would be appreciated.

    ---------------------------------
    | | | | | |
    ---------------------------------
    | | | | | |
    ---------------------------------
    | | | | | |
    ---------------------------------
    | | | | |
    ---------------------------------
    | | | | |
    ---------------------------------
    | | | | |
     
    Larry Dodd, Aug 15, 2003
    #1
    1. Advertising

  2. Larry Dodd

    Larry Dodd Guest

    This is great information but how would i do this based and a certain row.
    For instance, what if I wanted Row 6 Cell 0 formatted differently from other
    cells?

    "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote in
    message news:...
    > nothing to it. you would need to put the appropriate code in the
    > itemcreated, or itemdatabound event handler. Every time a row is created,

    it
    > fires off an event. trap the above event and use the datagrideventargs e

    to
    > customize.
    > something like this will work
    > if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
    > ListItemType.AlternatingItem || e.Item.ItemType ==
    > ListItemType.SelectedItem)
    >
    > {
    >
    > //catch the first row and span column zero over the next three columns
    >
    > e.Item.Cells[0].RowSpan = 4
    >
    > }
    >
    > "Larry Dodd" <> wrote in message
    > news:#...
    > > I want to be able to change some properties of certain cells on the
    > > datagrid. For instance, let's say the datagrid has 10 rows and 5

    columns.
    > I
    > > want the first five rows to be normal but on the 6th through 10th row. I

    > was
    > > the first two columns to have a background in the cell that is gray.
    > >
    > > Even better would be to have the first two columns on the 6th through

    10th
    > > row to span two columns. I have included a small example below. Any help

    > on
    > > either of these problems would be appreciated.
    > >
    > > ---------------------------------
    > > | | | | | |
    > > ---------------------------------
    > > | | | | | |
    > > ---------------------------------
    > > | | | | | |
    > > ---------------------------------
    > > | | | | |
    > > ---------------------------------
    > > | | | | |
    > > ---------------------------------
    > > | | | | |
    > >
    > >

    >
    >
     
    Larry Dodd, Aug 16, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.rcn.com
    Replies:
    1
    Views:
    9,808
    Chris Smith
    Jul 12, 2004
  2. Phillip Roncoroni
    Replies:
    14
    Views:
    1,137
    Toby A Inkster
    Apr 5, 2004
  3. Empire City
    Replies:
    3
    Views:
    432
    Empire City
    Apr 30, 2004
  4. Thomasa Gregg
    Replies:
    1
    Views:
    178
    Eliyahu Goldin
    Jun 9, 2004
  5. RJ
    Replies:
    1
    Views:
    260
    Eliyahu Goldin
    Feb 17, 2005
Loading...

Share This Page