ITGURU Posted October 16, 2017 Posted October 16, 2017 I have a table which currently alternates the row colour by using: <%If (Repeat1__numRows Mod 2) Then%> <%Else%> <%End If%> What I want to do is on the repeat region of the data, take 1 field value from the results and highlight that row using a specific colour i.e. Field value HOT = Highlight red, Field Value BLUE = Highlight blue I've tried changing the Repeat1_ tO If (recordsetname.Fields.Item("FieldName".Value) = "HOT" but this causes an error on the page and it doesn't load. Can anyone help me please? Thanks.
ReadTheNetwork Posted October 16, 2017 Posted October 16, 2017 Been a fair few years since I've done ASP, but you might want to use CSS ...
ITGURU Posted October 16, 2017 Author Posted October 16, 2017 Been a fair few years since I've done ASP, but you might want to use CSS ... How does this coding fit in with the rest of the above please?
ReadTheNetwork Posted October 16, 2017 Posted October 16, 2017 At the top within the you'll want to put .HOT { background-color: #ccf; } Then rather than using if statements you can use class @Value. This will then style your table properties (rows) however you want them to be styled. Easier to update. So for instance ... @Value being the value of the data you want to look up. - - - Updated - - - you can add more to the styles for the different row styles you would like to use.
Katy Posted October 16, 2017 Posted October 16, 2017 Not sure if that's a typo into here or actually in your code but I would expect: [color=#333333]If (recordsetname.Fields.Item("FieldName".Value) = "HOT" to read [/color][color=#333333]If recordsetname.Fields.Item("FieldName").Value = "HOT" then Although it's been yeeeears since I did ASP so it might be something else wrong. Or (assuming that's how to access a field inside a recordset in ASP land) then as @ReadTheNetwork said, "> and define a css class for each option[/color]
ITGURU Posted October 16, 2017 Author Posted October 16, 2017 I cannot get either way to work basically I've got a Recordset which is pulling the data out, got a 2 row table with selected fields from the recordset, then as a repeat row. The coding above has no effect . The if recordset.fields.item was doesn't bomb the page out with an error but doesn't colour anything.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now