S
Simon Harris
Hi All,
Ok, I have 6 datagrids, populated from 1 dataset. Each datagrid has 3
columns. There are 18 columns in the dataset.
I have written a sub to change the background colour of the row in the
datagrid, if the current rows 'booked' column value = 'yes'
Here is my code:
Public Sub CheckAvailability(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim strBooked As String = DataBinder.Eval(e.Item.DataItem,
"Booked").ToString()
If strBooked.ToLower = "yes" Then
e.Item.CssClass = "tariffsDGBooked"
End If
End If
End Sub
This works fine, but I actually need a 'booked' column for each datagrid -
ie. booked1, booked2...upto...booked6
I have added this to my data, and added the relevent booked column to each
datagrid, what I now need to do is change my sub so that it looks for the
correctly named 'booked' column (Obviously looking for 'booked' each time
isnt going to work. This is where I am stuck! I was thinking perhaps using
eventargs to send the datagrid id to the sub (I know the ID will match the
bookedX column name). I'm just not sure a) How to do this and B) is this the
right approach?
Hope someone has a suggestion!
Regards,
Simon.
Ok, I have 6 datagrids, populated from 1 dataset. Each datagrid has 3
columns. There are 18 columns in the dataset.
I have written a sub to change the background colour of the row in the
datagrid, if the current rows 'booked' column value = 'yes'
Here is my code:
Public Sub CheckAvailability(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim strBooked As String = DataBinder.Eval(e.Item.DataItem,
"Booked").ToString()
If strBooked.ToLower = "yes" Then
e.Item.CssClass = "tariffsDGBooked"
End If
End If
End Sub
This works fine, but I actually need a 'booked' column for each datagrid -
ie. booked1, booked2...upto...booked6
I have added this to my data, and added the relevent booked column to each
datagrid, what I now need to do is change my sub so that it looks for the
correctly named 'booked' column (Obviously looking for 'booked' each time
isnt going to work. This is where I am stuck! I was thinking perhaps using
eventargs to send the datagrid id to the sub (I know the ID will match the
bookedX column name). I'm just not sure a) How to do this and B) is this the
right approach?
Hope someone has a suggestion!
Regards,
Simon.