CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Auto increment number for each row?

Print topic Send  topic

Author Message
infobih

Posts: 58
Posted: 01/17/2010, 2:15 PM

Sorry, maybe this question is dumb, but i can't figure how to generate auto increment number for each row in Grid automatically.


Format:

1 data
2 data
3 data

etc

How to properly use function count()

Thanks a lot.
View profile  Send private message
damian

Posts: 838
Posted: 01/17/2010, 3:38 PM

what database are you using - easiest way is to set the primary key to auto-increment in the database....

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
infobih

Posts: 58
Posted: 01/17/2010, 11:02 PM

Damian thank you

I use MySQL database, but I have correctly set primary key auto-increment in the database. What I need is to generate on the fly counter for each row (Label control) in a row like

1,2,3..... not depending what actual ID primary key is

Thanks again
View profile  Send private message
rho


Posts: 85
Posted: 01/17/2010, 11:30 PM

This can be done using a label and a counter. For example:

First put

$rowcounter = 0;

on top of your page

Then, in the grid's BeforeShowRow Event, increment the counter:

$rowcounter+=1;

And then set your counter label to the counter value:

$sender->lblCounter->SetValue($rowcounter);

Hope this helps,

Rob.
View profile  Send private message
infobih

Posts: 58
Posted: 01/18/2010, 1:41 AM

Thanks Rob

I tried this, but had problem because in my case it is "Editable Grid" from "Order Entry" Example Pack de CodeCharge and I have already Events in "Before Row Show".

Don't work
View profile  Send private message
rho


Posts: 85
Posted: 01/18/2010, 1:54 AM

For the code to be entered, you have to create "Custom Code" on the BeforeShowRow event...
View profile  Send private message
damian

Posts: 838
Posted: 01/18/2010, 1:29 PM

look at this example:

http://forums.codecharge.com/posts.php?post_id=68718&s_keyword=alt+row

_________________
if you found this post useful take the time to help someone else.... :)
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.