Table Links in ASP

Discussion in 'C#' started by dnsl, Apr 28, 2008.

  1. #1
    Hai all
    I am new to ASP. In my ASP project i am trying to populate a table with certain records that i fetched from a database table .. the code is as below

    <%rs.movefirst
    DO UNTIL rs.eof
    i = i + 1
    %>
    <TR>
    <td><%=i%></td>
    <td><A HREF =U_ViewTransDet.asp><%=rs(0)%></A></td>
    <td><%=rs(1)%></td>
    <td><%=rs(2)%></td>
    </TR>

    Here the second colum in my table is given as link
    Let the column values be
    1 234 a 23
    2 267 g 24
    3 290 f 21

    The values 234, 267, 290 are displayed as links in the table. and when i click on the link 267
    it shud be redirected to a page named "U_ViewTransDet.asp" along with the value 267.
    How can i do this ? its very urgent .. plz help ..
     
    dnsl, Apr 28, 2008 IP
  2. dgxshiny

    dgxshiny Greenhorn

    Messages:
    65
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    23
    #2
    Replace <td><A HREF =U_ViewTransDet.asp><%=rs(0)%></A></td>

    With

    <td><a href="U_ViewTransDet.asp?value=<%=rs(0)%>"><%=rs(0)%>></a</td>
     
    dgxshiny, Apr 28, 2008 IP
  3. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #3
    slight typo in that response, should be:
    
    <td><a href="U_ViewTransDet.asp?value=<%=rs(0)%>"><%=rs(0)%></a></td>
    
    Code (markup):
     
    itcn, Apr 30, 2008 IP
  4. dylanj

    dylanj Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #4
    
    <%
    rs.MoveFirst
    Do Until rs.EOF
    i = i + 1
    %>
    <tr>
    <td><%=i%></td>
    <td><a href="U_ViewTransDet.asp?value=<%=rs(0)%>"><%=rs(0)%></a></td>
    <td><%=rs(1)%></td>
    <td><%=rs(2)%></td>
    </tr>
    <%
    Loop
    %>
    
    Code (markup):
    That should work
     
    dylanj, May 13, 2008 IP
  5. jawahar

    jawahar Active Member

    Messages:
    1,044
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #5
    I agree to the the examples given previously...

    But, DO NOT use DO While for looping thru recordsets..
    .
    use getrows!
     
    jawahar, May 25, 2008 IP