Groups | Blog | Home
all groups > asp.net datagrid control > july 2007 >

asp.net datagrid control : Datagrid Style Question


Bill Rossi
7/26/2007 3:41:07 PM
I would like to have the line between certain columns in my datagrid darker
or a different color than the other lines between columns. Does anyone know
how to accomplish this? Thanks in advance.

Bill Rossi


Teemu Keiski
8/1/2007 8:13:58 PM
Hi,

one way is in ItemCreated event (or with GridView in RowCreated event),
trying top set styles directly at the cells. For example:

Protected Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemCreated
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.AlternatingItem Then
e.Item.Cells(0).Style("border-left") = "10px solid red"
End If
End Sub


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

[quoted text, click to view]

AddThis Social Bookmark Button