Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > DataGrid Cell Problem

Reply
Thread Tools

DataGrid Cell Problem

 
 
Larry Dodd
Guest
Posts: n/a
 
      08-15-2003
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.

---------------------------------
| | | | | |
---------------------------------
| | | | | |
---------------------------------
| | | | | |
---------------------------------
| | | | |
---------------------------------
| | | | |
---------------------------------
| | | | |


 
Reply With Quote
 
 
 
 
Larry Dodd
Guest
Posts: n/a
 
      08-16-2003
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.
> >
> > ---------------------------------
> > | | | | | |
> > ---------------------------------
> > | | | | | |
> > ---------------------------------
> > | | | | | |
> > ---------------------------------
> > | | | | |
> > ---------------------------------
> > | | | | |
> > ---------------------------------
> > | | | | |
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set cell background based on cell value when datagrid is displayed RJ ASP .Net Datagrid Control 1 02-17-2005 09:37 PM
How to set and highlight text in JTable cell on selection and/or invoke cell editor directly. news.rcn.com Java 1 07-12-2004 10:22 PM
RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell? Empire City ASP .Net Datagrid Control 3 04-30-2004 12:19 AM
How do I have a table cell fetch another page to display within the cell? Phillip Roncoroni HTML 14 04-05-2004 05:58 PM
multilink cell phones multilinking shotgun 2 cell phones Calvin Cisco 1 11-07-2003 02:20 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57