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 -> General/Other

 Colour New / Empty Editable Grid Rows

Print topic Send  topic

Author Message
kevind

Posts: 251
Posted: 12/31/2010, 8:07 AM

I'd like to colour the empty rows of an editable grid to make them stand out from the other rows in the grid.

I know how to set up class values in the row but, I'm having difficulty figuring out how to tell if a row is empty.

Does anyone know the syntax to use in ASP to set the row class in the Before Show Row event of the Editable grid ? (I'm assuming that's where it would go).

thanks in advance.

Kevin
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 01/08/2011, 4:00 AM

I don´t really get what you want to do, ¿you mean a row from editable grid with empty fields?
or ¿you mean a full row empty fields?, if it´s the second case I´d answer first ¿why do I show a full row empty fields on the grid?
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
kevind

Posts: 251
Posted: 01/08/2011, 4:10 AM

Quote CodeChargeMVP:
I don´t really get what you want to do, ¿you mean a row from editable grid with empty fields?
or ¿you mean a full row empty fields?, if it´s the second case I´d answer first ¿why do I show a full row empty fields on the grid?

I mean a NEW row ready to take the insert of a new RECORD. I simply want to show that the row is not a row of blank data values - this is primarily for users new to the Yes Software's idea of editable grids. Ideally i want to colour the row slightly differently and perhaps change the title value so mouse overs show a comment about adding a new record.

When I view the page source output at runtime, there isn't anything that distinguishes a new row from an existing row of data.

Is there a RUNTIME variable or function I can check in the before show row event to allow me to do this.

thanks for any info.
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
andrewi

Posts: 162
Posted: 01/08/2011, 6:29 AM

Judging from the help file ( http://docs.codecharge.com/studio40/html/Components/RTP...itMode.html?toc ) you should be able to check the EditMode property in the BeforeShowRow event. If EditMode is False then you're on a new (Insert) row.

I'd suggest putting an attribute into one of the table cells and use the BeforeShowRow event to assign it a value like "New Row!" if EditMode is false. Use that to prove the theory. If it works, then you can use the attribute to display a message, or move it into the html tags to change a td or tr background colour, etc.
View profile  Send private message
andrewi

Posts: 162
Posted: 01/08/2011, 6:51 AM

My suggestion above doesn't work because EditMode returns True for every row, including new rows, in the BeforeShowRow event!

Here's another approach that does work.

Make sure that the grid's datasource includes the primary key or some other field that t will definitiely have a value for all existing rows.

In the BeforeShowRow event you just have to check whether this field has a value. If it's blank, then you are on one of the New Rows.

The code I've just used successfully is
  
if Sender.Recordset.fields("Record_ID") = "" THen Sender.Label1.value = "New Record"  
where Record_ID is your table's primary key (or other non-nullable column you choose to use). This sets the value of a label, but if you want to set HTML values then attributes are generally better (e.g. you can use an attribute more than once)
View profile  Send private message
kevind

Posts: 251
Posted: 01/08/2011, 7:32 AM

i'll use your last suggestion, that's straight forward

Quote andrewi:
My suggestion above doesn't work because EditMode returns True for every row, including new rows, in the BeforeShowRow event!

Here's another approach that does work.

Make sure that the grid's datasource includes the primary key or some other field that t will definitiely have a value for all existing rows.

In the BeforeShowRow event you just have to check whether this field has a value. If it's blank, then you are on one of the New Rows.

The code I've just used successfully is
  
if Sender.Recordset.fields("Record_ID") = "" THen Sender.Label1.value = "New Record"  
where Record_ID is your table's primary key (or other non-nullable column you choose to use). This sets the value of a label, but if you want to set HTML values then attributes are generally better (e.g. you can use an attribute more than once)

_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
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.