CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 [RESOLVED] - Highlight Row based on yes/no db field

Print topic Send  topic

Author Message
brandy4678

Posts: 7
Posted: 05/03/2010, 8:27 AM

I work for a company where we have operators that keep online logs. They are wanting to have the option to highlight certain entries they put in. I can't find anything in ASP that will help me figure out how to accomplish this. I added a 'bit' field to their db table, then added a hidden field to the grid. I want to say If 'hiddenfield' =1 then the row will be yellow.

Has anyone tried to do this or successful accomplished it in ASP. Thanks for your time and help.
_________________
Brandy
View profile  Send private message
brandy4678

Posts: 7
Posted: 05/03/2010, 1:40 PM

I can add a litte more onto my question now...this below is how far i've gotten. I'm trying to loop through records and only highlight yellow the records where the MuHighLight field is true.

'Create DB Connection
Dim Conn, RS, vNum
Const adOpenStatic = 3, adLockOptimistic = 3, adUseClient = 3
Set Conn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.Recordset")
'OPEN DATABASE CONNECTION
Conn.Open "Provider=SQLOLEDB.1;Data Source=Server;Initial Catalog=Intranet","user","password"
RS.CursorLocation = adUseClient
'OPEN RECORDSET
RS.Open "SELECT * FROM GenMLRUds", Conn, adOpenStatic, adLockOptimistic

RS.MoveFirst
vNum = 0

On Error Goto 0
Do While Not RS.EOF
If RS("MuHighLight") = true then
GenMLRuds.RowStyle.value = "AltRow"
else
GenMLRuds.RowStyle.value = "Row"
end if


'MOVE TO NEXT RECORD
vNum = vNum + 1
'Msgbox vNum
RS.Movenext
Loop


'CLOSE CONNECTIONS
RS.Close
Conn.Close
'SET CONNECTIONS TO NOTHING
Set RS = nothing
Set Conn = nothing

I just assumed that as i looped through the records it would only change the rowstyle for an indiviual row, but i'm finding that this is not the case...if anyone's done this, please help...

Thanks
Brandy

_________________
Brandy
View profile  Send private message
Waspman

Posts: 948
Posted: 05/04/2010, 11:47 PM

I do this by assigning the cell value a colour in the HTML code. So if field = 1 then Hidden field value = #CCCCCC.


Then the HTML code insert - bgcolor="{Hidden field}"

Works fine accept CCS replaces it every time you publish ha, bless ;-)
_________________
http://www.waspmedia.co.uk
View profile  Send private message
brandy4678

Posts: 7
Posted: 05/05/2010, 6:36 AM

Thanks for the reply...I ended up almost doing exactly just what you said.

CSS automatically has a .ROW and a .ALTROW in the style sheet.
When i set up my pages I only use .ROW, so I looked at the HTML of the page I had trouble with and figured out which CSS file it used. I then went into my local project into the STYLES folder and opened up that style sheet in a text editor and changed my .ALTROW color value to the highlight color I wanted to use. Once you republish the project with the local STYLE sheet edited, you won't have to change it anymore, each time you publish.

Then I went into HTML added the label "RowStyle"
<tr class="{RowStyle}">

Then added this code in the "BeforeShowRow" event

GenMLRuds.RowStyle.Value ="Row"

If GenMLRuds.MuHighlight.Value = true then
GenMLRuds.RowStyle.Value ="AltRow"
else
end if



It now works perfectly!!! :-D



_________________
Brandy
View profile  Send private message
Waspman

Posts: 948
Posted: 05/06/2010, 12:43 AM

Brill!

I use it to allow people to specify different colours in a booking calendar and for colour tagging Tutor/Courses so I need lots of colours which they select from a js colour picker:)


T


OH! put solved on the post...ta
_________________
http://www.waspmedia.co.uk
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.