This topic is locked

Get of each id ,of each line

4/13/2009 2:52:10 PM
ASPRunnerPro General questions
R
Ricardo Web author

Hi,
In my page Client_list.asp , shows 30 clients in list, how can get Id of each client of each line,for use after, example in list 30 clients:
IDClient , Nome , City

1 , Jose , Bel Mont

2, Maria, Paris
I need rs("IDClient") of each client, for use,how to make?
Remember : The clients are listed by asprunner in page client_list_asp by your sqlquery internal automatically.
Help me please?
tanks.

J
Jane 4/14/2009

Hi,
all field values are available in the List page: After record processed event on the Events tab:

Response.Write rs("IDClient")

R
Ricardo Web author 4/14/2009

ok good, but i need of each ID for use after in other "Code snippet inserted",then i need put each id in one variable Session for example, for use this Session in future.
How can i make a loop in Event:**List page: After record processed** for get each ID and put in of each Session?
Any ideia?
Tanks.

J
Jane 4/14/2009

Hi,
you don't need loop in the List page: After record processed event. This event is executed for each record separately.

R
Ricardo Web author 4/14/2009

Example :

my list Client_list.asp shows idClient 4 and idClient 5
iDClient Name City

4 Jose Paris

5 Maria Orlando
in Event: List page: After record processed i put
Response.Write rs("IDClient")
result of response : 45
But i don't understand, how get each variable rs("idClient") for manipulation, i need idClient "4" separate idClient "5" for future manipulation.
Please?

J
Jane 4/14/2009

Hi,
please give me a detailed description of what you want to achieve and where you want to use these values and I'll help you with sample code.

R
Ricardo Web author 4/14/2009

Look images, in Client_list.asp



note image

  1. rs("idClient") i need
  2. button (code snippet inserted) , after click in button red , a link redirect for same page client_list.asp with a variable clientecliente (look footer IE) receptor value of each rs("idclient"), hence i need each idClient for aplly in

    localhost/financeiro/clientes_list.asp?clientecliente=!!!!HERE!!!!!

    (view item 3 image)
    This code in program



    code snippet inserted
    str = "select ativo from clientes where idclientes = 4"

    set rs1 = dbConnection.execute(str)

    if rs1("ativo") = true then%>

    <a href="Clientes_list.asp?clientecliente="><img src="imagens/icon_ativo.gif" alt="Click aqui para Desativar" width="18" height="18" border="0" /></a>
    <%else%>

    <a href="Clientes_list.asp?clientecliente="><img src="imagens/icon_inativo.gif" alt="Click aqui para Desativar" width="18" height="18" border="0" /></a>
    <%end if
    Please check, tanks.

J
Jane 4/15/2009

Unfortunately it's impossble to pass values to the custom events.

As workaround create alias for IDClientes field on the Edit SQL query tab:

select IDClientes,

IDClientes as button,

...

from TableName


Then set up button field as custom on the "View as" settings dialog on the Visual Editor tab and use your code on this dialog:

if rs1("ativo") = true then

strValue = "<a href=""Clientes_list.asp?clientecliente=" & strValue & """><img src=""imagens/icon_ativo.gif"" alt=""Click aqui para Desativar"" width=""18"" height=""18"" border=""0"" /></a>"

else

strValue = "<a href=""Clientes_list.asp?clientecliente=" & strValue & """><img src=""imagens/icon_inativo.gif"" alt=""Click aqui para Desativar"" width=""18"" height=""18"" border=""0"" /></a>"

end if

R
Ricardo Web author 4/15/2009

Jane,
Sorry, but don´t work that solution,or i don´t understand your solution, see the images:
Edit SQL
i created a alias for field IDClientes with name "but" same name button on the Visual Editor,



Visual Editor
The button, name "but" has the code equals you posted
str = "select ativo from clientes where idclientes = 4"

set rs1 = dbConnection.execute(str)

if rs1("ativo") = true then

strValue = "<a href=""Clientes_list.asp?clientecliente=" & strValue & """><img src=""images/icon_ativo.gif"" alt=""Click aqui para Desativar"" width=""18"" height=""18"" border=""0"" /></a>"

else

strValue = "<a href=""Clientes_list.asp?clientecliente=" & strValue & """><img src=""images/icon_inativo.gif"" alt=""Click aqui para Desativar"" width=""18"" height=""18"" border=""0"" /></a>"

end if

response.write strvalue 'response write for view in the page the button




Page
In Page after click in button red, does not have the expected result ,the link in footer Internet Explorer not appear value for clientecliente

localhost/financeiro/clientes_list.asp?clientecliente=!!!!HERE!!!!! , should be "idClientes" that line specifies ,example number "4" OR

localhost/financeiro/clientes_list.asp?clientecliente=4



What´s happened?
tanks.

J
Jane 4/16/2009

Try to use this one:

str = "select ativo from clientes where idclientes = " & strValue

set rs1 = dbConnection.execute(str)

if rs1("ativo") = true then

str = "<a href=""Clientes_list.asp?clientecliente=" & strValue & """><img src=""images/icon_ativo.gif"" alt=""Click aqui para Desativar"" width=""18"" height=""18"" border=""0"" /></a>"

else

str = "<a href=""Clientes_list.asp?clientecliente=" & strValue & """><img src=""images/icon_inativo.gif"" alt=""Click aqui para Desativar"" width=""18"" height=""18"" border=""0"" /></a>"

end if

strValue = str

R
Ricardo Web author 4/16/2009

I tried, see modified
Event but
Your new code



Page
see the error page in sql query str = "select ativo from clientes where idclientes = " & strValue
but , what is the variable strValue?

has nothing in variable
try response.write strValue
return nothing... because this will generate error page, strValue equals idClientes (integer) or equals string with integer ERROR!!!



I had understood this "strValue" had the value of idClientes of line!?!?
Any ideia?
tanks

J
Jane 4/17/2009

Ricardo,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.