• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

html query report /every other row grey

New Here ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

Hello
i have this query to html report
do you know how to make every other row grey in the out pu of the query.
??


and where do i put it in this code below?



thanks in advance



<cfquery name="GetCompanies"
datasource="#Request.MainDSN#">
SELECT
CompanyID,
CompanyName,
Address,
City,
State,
ZipCode,
Comments
FROM
Company
ORDER BY
CompanyName ASC
</cfquery>

<html>
<head>
<title>ColdFusion MX Bible</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>

<h1>Company List</h1>

<TABLE width=100% align="left" border="4" rules="all">
<tr>

<td><b>ID</b></td>
<td><b>Name</b></td>
<td><b>Address</b></td>
<td><b>City</b></td>
<td><b>State</b></td>
<td><b>ZIP Code</b></td>
<td> </td>
</tr>
<cfoutput query="GetCompanies">
<tr>

<td>#CompanyID#</td>
<td>#CompanyName#</td>
<td>#Address#</td>
<td>#City#</td>
<td>#State#</td>
<td>#ZipCode#</td>
<td>
<a href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
<a href="CompanyAddForm.cfm">Add</a>
<a href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
<a href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
</td>
</tr>
</cfoutput>
</TABLE>

</body>
</html>
TOPICS
Advanced techniques

Views

327

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Jul 06, 2006 Jul 06, 2006
Something like this?

<TABLE width=100% align="left" border="4" rules="all">
<tr>

<td><b>ID</b></td>
<td><b>Name</b></td>
<td><b>Address</b></td>
<td><b>City</b></td>
<td><b>State</b></td>
<td><b>ZIP Code</b></td>
<td> </td>
</tr>
<cfoutput query="GetCompanies">
<tr bgcolor="<cfif currentrow mod 2>##808080<cfelse>##ffffff</cfif>">

<td>#CompanyID#</td>
<td>#CompanyName#</td>
<td>#Address#</td>
<td>#City#</td>
<td>#State#</td>
<td>#ZipCode#</td>
<td>
<a href="EmployeeList.cfm?CompanyID=#Company...

Votes

Translate

Translate
LEGEND ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

The fastest, but crudest and ugliest.

<cfoutput query="GetCompanies">
<tr #IIF(GetCompanies.CurrentRow MOD
2,DE(''),DE('backgroundColor="##999"'))#>

kellyhondalovesmusic wrote:
> Hello
> i have this query to html report
> do you know how to make every other row grey in the out pu of the query.
> ??
>
>
> and where do i put it in this code below?
>
>
>
> thanks in advance
>
>
>
> <cfquery name="GetCompanies"
> datasource="#Request.MainDSN#">
> SELECT
> CompanyID,
> CompanyName,
> Address,
> City,
> State,
> ZipCode,
> Comments
> FROM
> Company
> ORDER BY
> CompanyName ASC
> </cfquery>
>
> <html>
> <head>
> <title>ColdFusion MX Bible</title>
> <link rel="stylesheet" href="styles.css">
> </head>
>
> <body>
>
> <h1>Company List</h1>
>
> <TABLE width=100% align="left" border="4" rules="all">
> <tr>
>
> <td> ID</td>
> <td> Name</td>
> <td> Address</td>
> <td> City</td>
> <td> State</td>
> <td> ZIP Code</td>
> <td> </td>
> </tr>
> <cfoutput query="GetCompanies">
> <tr>
>
> <td>#CompanyID#</td>
> <td>#CompanyName#</td>
> <td>#Address#</td>
> <td>#City#</td>
> <td>#State#</td>
> <td>#ZipCode#</td>
> <td>
> <a href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
> <a href="CompanyAddForm.cfm">Add</a>
> <a href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
> <a href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
> </td>
> </tr>
> </cfoutput>
> </TABLE>
>
> </body>
> </html>
>
>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

Something like this?

<TABLE width=100% align="left" border="4" rules="all">
<tr>

<td><b>ID</b></td>
<td><b>Name</b></td>
<td><b>Address</b></td>
<td><b>City</b></td>
<td><b>State</b></td>
<td><b>ZIP Code</b></td>
<td> </td>
</tr>
<cfoutput query="GetCompanies">
<tr bgcolor="<cfif currentrow mod 2>##808080<cfelse>##ffffff</cfif>">

<td>#CompanyID#</td>
<td>#CompanyName#</td>
<td>#Address#</td>
<td>#City#</td>
<td>#State#</td>
<td>#ZipCode#</td>
<td>
<a href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
<a href="CompanyAddForm.cfm">Add</a>
<a href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
<a href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
</td>
</tr>
</cfoutput>
</TABLE>

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

LATEST
thanks this one works great

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation