counter

Discussion in 'ASP.NET / ASP.NET Core' started by gibson, Dec 15, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. hey i'm using asp to print all the records from a database in a table
    But i want that i have a number for each button so record(row) one must be on the button one etc. Then i can refer to write the record (line where the button is clicked)to my database. Can you give me all the details pleasss
    thankx

    Gibson

    <%
    Do while not rstKlanten.EOF

    response.Write "<td width='230' align='center'>" &amp; rstKlanten("Titel") &amp; " </td>"
    response.Write "<td width='300'align='center'>" &amp; rstKlanten("artikel") &amp; " </td>"
    response.Write "<td width='70' align='center'>" &amp; rstKlanten("Prijs") &amp; " </td>"
    response.Write "<td width='90' align='center'>" &amp; rstKlanten("Kode") &amp; " </td>"
    %>
    <onclick=1=parseInt(this.value)+1">
    <form action="boeking3.asp" method="post" name="form";">
    <td width='120' align='center'><input type="submit" value="onclick" name="B3" > </td></tr>
    </FORM>
    <%
    rstKlanten.MoveNext
    Loop
    %>
     
  2. You can work with a hidden input field within your form in the loop.
    <%
    Dim RowCounter
    RowCounter=1
    Do while not rstKlanten.EOF

    response.Write "<td width='230' align='center'>" &amp; rstKlanten("Titel") &amp; " </td>"
    response.Write "<td width='300'align='center'>" &amp; rstKlanten("artikel") &amp; " </td>"
    response.Write "<td width='70' align='center'>" &amp; rstKlanten("Prijs") &amp; " </td>"
    response.Write "<td width='90' align='center'>" &amp; rstKlanten("Kode") &amp; " </td>"
    %>
    <onclick=1=parseInt(this.value)+1">
    <form action="boeking3.asp" method="post" name="form";"><input type=hiddenid=row value='<%=RowCounter%>'>
    <td width='120' align='center'><input type="submit" value="onclick" name="B3" > </td></tr>
    </FORM>
    <%
    RowCounter= RowCounter+1
    rstKlanten.MoveNext
    Loop
    %>


    In the boeking3.asp-page: before writing check the request.form("ow") value to know which row triggered the post.

    success

    --
    Steurm
    www.steurm.net/steurm
    [​IMG]
     
  3. Yes i did it and how must i check now in boeking3.asp? I don't see any value.




    <%@ Language="VBScript"%>


    <% Option Explicit


    dim intgetal


    intgetal=request.form("row")


    response.write("getal is") &amp; intgetal





    %>
     
  4. Solved

    thanks
     
  5. Did you check whether the RowCounter variable was written correctly ? Change the type of the input from hidden to text, and see what is shown ... Maybe Rowcounter was'nt filled in in the first place.


    --
    Steurm
    www.steurm.net/steurm
    [​IMG]
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page