CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to display icon instead of Boolean value in Grid

Print topic Send  topic

Author Message
okee

Posts: 24
Posted: 02/07/2008, 6:14 PM

Hi

i have a grid that lists customers, In the table for the customers
a few of the fields are boolean i.e married yes/no where its 1 for
yes and 0 for no.
On my grid when displaying a list of customers I want the values
to be displayed as a tick for Yes or an x for No.
How do I do this ?
i did get it working ages ago but can't find the code.

Thanks

Richard
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/13/2008, 8:36 PM

okee
Have you resolved this or are you still looking for suggestions??
View profile  Send private message
okee

Posts: 24
Posted: 02/14/2008, 3:26 AM

hi mambo

Yes I managed to figure it out.
My main problem was forgetting to change the label Content property to HTML
For the record here's what i did

In my grid I had a label called redirect_to_website that displayed a boolean value
1 or 0 (1 meaning yes 0 meaning no) but to make it look nicer i wanted to display a
Correct tick mark image for yes and blank for No

So for the label redirect_to_website i changed the Content property to HTML
and added this code to Before Show

global $restaurant;
if ($restaurant->redirect_to_website->GetValue() =="1")
{
$restaurant->redirect_to_website->SetValue("<IMG SRC='icons/correct.jpg' ALT='This Restaurant is redirected to the Customers Website' >");
}
else
{
$restaurant->redirect_to_website->SetValue("<IMG SRC='icons/imageplacer.jpg'>");
}

imageplacer.jpg is just a 1x1 pixel image which basically gives a blank cell


okee
View profile  Send private message
Aleister

Posts: 73
Posted: 02/18/2008, 12:53 AM

There is another simple way to do that.

Let's say that you have a label in your grid named $redirect_to_website. Right click on it and convert to image. Edit the generated code like this:
From
<img src="{redirect_to_website}">
To
<img src="images/redirect_to_website{redirect_to_website}.gif">

Now create three icons named redirect_to_website0.gif, redirect_to_website.gif and redirect_to_website1.gif and put them under images/
View profile  Send private message
okee

Posts: 24
Posted: 02/18/2008, 2:30 AM

Thnaks Aleister
That's a handy way of doing it, hadn't thought of it.

Richard
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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