E
Elton Wang
Hi Steve,
Suppose you want to change text in some column depending
on the data in data source, you can do it in ItemDataBound
event.
Dim itemType As ListItemType = e.Item.ItemType
If itemType = ListItemType.AlternatingItem OrElse itemType
= ListItemType.Item Then
' Get data from underlying data source
Dim drv As DataRowView = CType(e.Item.DataItem,
DataRowView)
Dim cell As TableCell = e.Item.Cells(colIndex)
If drv(colindex) = (today's event) Then
cell.Text = "Today"
cell.BackColor = Color.Red
End If
End If
The ItemDataBound will automatically loop thru whole rows
HTH
Elton Wang
elton_wang_hotmail.com
event is today, I want to alter the text to say "Today!"
and change the color.
the "right" way.
Suppose you want to change text in some column depending
on the data in data source, you can do it in ItemDataBound
event.
Dim itemType As ListItemType = e.Item.ItemType
If itemType = ListItemType.AlternatingItem OrElse itemType
= ListItemType.Item Then
' Get data from underlying data source
Dim drv As DataRowView = CType(e.Item.DataItem,
DataRowView)
Dim cell As TableCell = e.Item.Cells(colIndex)
If drv(colindex) = (today's event) Then
cell.Text = "Today"
cell.BackColor = Color.Red
End If
End If
The ItemDataBound will automatically loop thru whole rows
HTH
Elton Wang
elton_wang_hotmail.com
modify the columns of each row.-----Original Message-----
ASP.NET 1.1, Web Forms :
In my code I create a DataSet, then a DataTable within it.
I want to loop through the rows of the DataTable and
DataGrid, to show upcoming events form my club. If theFor example, I create a table that gets bound to a
event is today, I want to alter the text to say "Today!"
and change the color.
loop via old ASP, but am new to ASP.NET and want to learnI figure that I can resort to the old "Response.Write"
the "right" way.