CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Changing Table Cell Color - Little More Help

Print topic Send  topic

Author Message
dblayout
Posted: 08/25/2003, 2:49 PM

Ok, I have copied the code from the help as best I can. The Help says to add 2 lables called RowStyle & RowStyle1. It doesn't tell you where to add them. If I add these lables to each cell, the code works but each cell now displays the RowStyle inaddition to the actual data from the record. I need some clarification. Where do I add these 2 labels so that their value does NOT display on my page but that I can use them to change the cell colors?

Thanks

Chris
glerma
Posted: 08/25/2003, 3:18 PM

Dblayout. It clearly states how to do this...

Add two Labels called RowStyle and RowStyle1:
<!-- BEGIN Row -->
<tr>
<td class="{RowStyle}">{TaskName}</td>
<td class="{RowStyle1}">{Status}</td>
</tr>
<!-- END Row -->

******************************************************
Assuming the above example.

You have to add your labels to your class parameters for each row. You can insert labels in HTML mode easily. Just insert your cursor in-between the parenthesis and delete the current value, then create thes new Labels with the RowStyle and RowStyle1 names.
DaveRexel
Posted: 08/25/2003, 3:26 PM

::
Chris

Making the assumption here that you are using of the CCS templated technologies, please correct me if I'm wrong.

The label is an ambiguous term here, adding a label component from the toolbar will break your display. The correct method is to apply Template tags/labels/variables (I prefer to think of them as elements) as follows in HTML-mode for hand :

- type arbitrary names surrounded by curly brackets eg {RowStyle} as class values...
- in before Show Row Event just do a check for even/odd row and set the template element {RowStyle} accordingly

=== from CCS help

'Global variable
Dim Counter

Function Tasks_BeforeShowRow()

If Counter = 0 Then
Tasks.RowStyle.Value = "ClearDataTD"
Tasks.RowStyle1.Value = "ClearDataTD"
Counter = 1
Else
Tasks.RowStyle.Value = "ClearAltDataTD"
Tasks.RowStyle1.Value = "ClearAltDataTD"
Counter = 0
End if

End Function

Maybe this can help?

Dave



glerma
Posted: 08/25/2003, 4:10 PM

Dave.

- type arbitrary names surrounded by curly brackets eg {RowStyle} as class values...


I think this is possible, however I think that CCS will complain upon code-generation, if you create the arbitrary bracked value without the associated Label Control that exists for it.

Please correct me if im wrong.

-george
DaveRexel
Posted: 08/25/2003, 4:41 PM

::

It's why I call the term Label ambiguous :

One the one hand you have the Label Component as produced by clicking in the toolbar while in Design-Mode === messing with this in HTML-mode with manual coding will very correctly cause CCS to throw a fit and want to delete the component at the first opportunity

On the other hand just going to the HTML mode and replacing the value of a HTML attribute with a Template Element (the curly bracket thing added manually in a HTML tag) will not throw an error and will let you manipulate its value as part of the Template collection.

Hope this does not cloud the issue further.

Dave
dblayout
Posted: 08/26/2003, 8:44 AM

In my opioun, it is not very clear. It says to add 2 Labels. Ok, there at least 2 Label types (Form & HTML). I assume they mean the Form label. Now, do I just abrraterially place their code anywhere I want on the page or does it go in the grid. If it goes in the grid, then it is going to show up as a data element. Do I add a new row to add these to or do I add the 2 columns to an existing row - thereby screwing up my data row?

Dave, what you suggested is what I did. I just edited the HTML & changed it from: class="GraphiteDataTD" to class="{RowStyle1}". But doing that does not allow me to always access this variable from code. Here is my code:

If gvCounter = 0 Then
Phone_List.RowStyle1.Value = "GraphiteDataTD"
Phone_List.RowStyle2.Value = "GraphiteDataTD"
gvCounter = 1
Else
Phone_List.RowStyle1.Value = "GraphiteAltDataTD"
Phone_List.RowStyle2.Value = "GraphiteAltDataTD"
gvCounter = 0
End if

When I run the page, it errors off telling me this:

Object doesn't support this property or method: 'Phone_List.RowStyle2'
/dblayout/Phone_List_events.asp, line 71

Here is line 71: Phone_List.RowStyle2.Value = "GraphiteDataTD"

Here is my HTML:

<!-- BEGIN Row -->
<tr class="GraphiteDataTD">
<td class="{RowStyle1}" nowrap><a class="BlueNoteDataLink" href="{SORT_NAME_Src}">{SORT_NAME}</a></td>
<td class="{RowStyle2}" nowrap>{COMPANY}</td>
<td class="{RowStyle3}" nowrap>{PHONE1}</td>
<td class="{RowStyle4}" nowrap>{PHONE2}</td>
<td class="{RowStyle5}" nowrap>{PHONE3}</td>
<td class="{RowStyle6}" nowrap>{PHONE4}</td>
</tr>
<!-- END Row -->

I can't figure out why RowStyle1 works but RowStyle2 does not. Any ideas?

Thanks for your time on this.
glerma
Posted: 08/26/2003, 10:40 AM

dblayout.

I was able to accomplish the task in about 10 minutes by following DIRECTLY with the instructions in the Help Page. I think you should do the same.


This is how i did it.

1. Deleted the default class parameters frpm my Grid.
From:
<td class="SuppMain2DataTD">{Label1} </td>
<td class="SuppMain2DataTD">{Label2} </td>

To:
<td class="">{Label1} </td>
<td class="">{Label1} </td>

2. Then I Added two Labels in "HTML mode". Yes. You can do this. You should do it this way. Set your cursor in the blank class parameters and add two labels from your Forms ToolBar.

3. I added the below code to finish the process. This is in PHP, but it is generally the same for ASP. In fact I copied the code from the help page. The KEY to this whole thing is to make sure you have chosen a defined Alt Data TD for your alternating color. This must be created in your Theme if it does not exist yet. This is required because you are using Cascading Style Sheets (CSS)using an object class to define the look of the row.

Thats it! Simple. See below Code Samples from Working Example.

P.S. I also do know know why you are using 5 or 6 different Color Schemes. You should only need 2. One for the even rows. The other for the odd rows.



*********************************
My HTML Grid
<!-- BEGIN Row -->
<tr>
<td class="{RowStyle}">{Label1} </td>
<td class="{RowStyle2}">{Label2} </td>
</tr>
<!-- END Row -->
*********************************

*********************************
My Before Show Row Code (PHP)

global $NewGrid1;
global $Counter;

if ($Counter == 0) {
$NewGrid1->RowStyle->SetValue("SuppMain2DataTD");
$NewGrid1->RowStyle2->SetValue("SuppMain2DataTD");
$Counter = 1;
} else {
$NewGrid1->RowStyle->SetValue("SuppMain2AltDataTD");
$NewGrid1->RowStyle2->SetValue("SuppMain2AltDataTD");
$Counter = 0;
}
*********************************
dblayout
Posted: 08/26/2003, 11:56 AM

glerma, 1st of all, there isn't supposed to be multiple color schemes, I'm not finished cleaning up the style tags after switching schemes, since CCS doesn't do this (like it should) - but that has nothing to do with the question. Are you asking why I have 6 RowStyle tags? Don't I need one for each column? Isn't <TD></TD> a column definition?

I see your code. Mine looks just like it doesn't it? Except I have 6 columns (cells) per row where you just have 2 columns (cells) per row. According to the help, each column (cell) has a different Class="{RowStyle?}" tag. So I did the same. 6 columns, 6 different tags.

I got it working by using the same tag (RowStyle1) for all 6 columns (cells). I didn't realize I could use the same variable name in multiple places like this:


<!-- BEGIN Row -->
<tr class="GraphiteDataTD">
<td class="{RowStyle1}" nowrap><a class="GraphiteDataLink" href="{SORT_NAME_Src}">{SORT_NAME}</a></td>
<td class="{RowStyle1}" nowrap>{COMPANY}</td>
<td class="{RowStyle1}" nowrap>{PHONE1}</td>
<td class="{RowStyle1}" nowrap>{PHONE2}</td>
<td class="{RowStyle1}" nowrap>{PHONE3}</td>
<td class="{RowStyle1}" nowrap>{PHONE4}</td>
</tr>
<!-- END Row -->

The help is NOT very clear on how to setup the columns, unless maybe you are already a very experienced CCS user (which I am not as I am sure you noticed).

Anyway, I do thank you for your help but please lose the condesending attitude that seems to be in your messages. You may need help in the future & I hope someone treats you with the respect you feel you deserve. Your are not doing the CCS community any favors by having this attitude.

Thanks again to you and Dave. I really do appreciate it even if I do get frustrated.

glerma
Posted: 08/26/2003, 2:03 PM

dblayout.

I don't really care if you take my advice or not. Or whether you like my attitude. Yes. I am a somewhat experienced CCS user, but I certainly have many problems too. The problem is that I AM trying to do the community favors by attempting to help out with questions. For free and at my own time I might add. I will go to many lengths to answer a fellow Codecharge user's question. The problem is that I do not do this unconditionally. I expect that the user will clearly state the problem, lay-down the dev environment and product version, and most importantly, research the problem as much as possible BEFORE posting their question. This is not experience-dependent either. It's common sense dependent. I will not be a crutch to user's trying to find the easy way out by getting everyone else to fix their problems.

I admit that I was being condescending in my post here, but it really does clearly state how to do this. I was assuming you were at least mid-level experience if you were attempting this. You must have at least a basic understanding of the API if you are going to manipulate beyond it's capabilities. If you are unable to grasp the instructions in the help pages, then I question why you are attempting to perform this "advanced" technique. Instead you should stick to the normal method of using CCS's default API method for alternating your row color. I'm sure you have heard the saying: "You must crawl, before you can walk".

And finally, regardless of my attitude, I still made an effort to help you out. If you focus on that point alone, you should be able to dis-regard my attitude. If you want un-conditional non-opinionated help, then post your question to Yes Software Support. You are paying them, not me. By posting just my opinion and not attempting to help the user at all WOULD be a great dis-service to the community. That is not what I am doing.


Regards,
g
dblayout
Posted: 08/26/2003, 2:20 PM

If someone gives help with a condesending attitude, they won't be asked very often for help because if their attitude. Cost for the advice has nothing to do with anything. If I paid you, would your attitude have been better? Again, you are not doing anyone any favors when you give advice with such a negative attitude. All the attitude does is reflect upon you personally & professionally (which that attitude is NOT professional - paid or not). I did state the problem. 'Clearly' depends on the reader sometimes. As I said in my previous post, I followed the instructions & my code looked like yours, yet mine did not work. You failed to mention that.

It's not easy to disregard an attitude. The attitude or tone in which a comment is given tends to reflect the person giving it and their attitude towards other people.

Again, I did appreciate your advice and attempt at help.

Thanks again.

nuf said
RonB
Posted: 08/26/2003, 3:32 PM

Sorry to bud in. I had some trouble to with this and finaly decided to throw away the help and just use the template structure itself. I have a table called site settings, in it a field called row color.

the html looks like this:

<!-- BEGIN Row -->
<tr>
<td class="" bgcolor="{color1}">{TaskName}</td>
<td class="" bgcolor="{color2}">{Status}</td>
</tr>
<!-- END Row -->

In the page before show event I use the set tag action to send the values to the page. The following code is for various settings that are user definable via an admin page:

//Page_BeforeShow @1-D8BD2467
function Page_BeforeShow()
{
$Page_BeforeShow = true;
//End Page_BeforeShow

//Set Tag @12-56FA7655
global $Tpl;
$db = new clsDBConnection1();
$SQL = "SELECT * from rb_site_settings";
$db->query($SQL);
$Result = $db->next_record();
if ($Result)
{
$my_back=$db->f("site_background");
$my_font=$db->f("site_font");
$my_top=$db->f("site_top");
$my_border=$db->f("site_table_border_color") ;
$my_table_back=$db->f("site_table_back") ;
$my_table_style=$db->f("site_table_border_style");
$my_table_width=$db->f("site_table_border_width");
$my_menu_color=$db->f("menu_bar_menu_mouseover");
$my_menu_bar=$db->f("menu_bar_color");
$my_menu_font_c=$db->f("menu_bar_font_color");
$my_menu_font_o=$db->f("menu_bar_font_over");
$my_menu_font_co=$db->f("menu_bar_font_color_over");
$my_menu_font=$db->f("menu_bar_font");
$my_menu_font_size=$db->f("menu_bar_font_size");
$my_menu_font_size_o=$db->f("menu_bar_font_size_over");
}
$Tpl->SetVar("site_background", $my_back);
$Tpl->SetVar("site_font", $my_font);
$Tpl->SetVar("site_top", $my_top);
$Tpl->SetVar("border_c", $my_border);
$Tpl->SetVar("table_back", $my_table_back);
$Tpl->SetVar("border_s", $my_table_style);
$Tpl->SetVar("border_w", $my_table_width);
$Tpl->SetVar("menu_color", $my_menu_color);
$Tpl->SetVar("bar_color",$my_menu_bar );
$Tpl->SetVar("font_color", $my_menu_font_c);
$Tpl->SetVar("menu_font_o", $my_menu_font_o);
$Tpl->SetVar("font_color_over", $my_menu_font_co);
$Tpl->SetVar("menu_font", $my_menu_font);
$Tpl->SetVar("font_size", $my_menu_font_size);
$Tpl->SetVar("font_size_o", $my_menu_font_size_o);

unset($db);


//End Set Tag

//Close Page_BeforeShow @1-4BC230CD
return $Page_BeforeShow;
}
//End Close Page_BeforeShow

Just another way of manipulating these values. You could even set them as session variables and call them on each page but I'm lazy. I do everything I want the user to be able to change and then copy the code to each page :-)
I do this just because I keep messing up CSS for some stupid reason. When I have some time on my hands I defenitely have to get the hang of that stupid CSS stuff. I have a faint idea it might actualy be easier :-)

Ron

   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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