Gridview, links and passing a value

Discussion in 'ASP' started by CaJack, May 3, 2007.

  1. CaJack

    CaJack New Member

    Joined:
    Mar 21, 2007
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    I’m having trouble finding a way to pass a value from a gridview link item to the next page. If a user searches for a CD say queen and clicks submit all the CDs with the name queen are shown with there unique numbers and dates added. If the user clicks on one of the CD ID’s it takes them to a page called cdview, the cd id will be used to retrieve all the information about the cd. Here’s an example…

    Search CD = Queen (clicked submit)

    (Gridview)
    CD ID__________CD Name________Date
    12______________Queen_________12/4/04
    56______________Queen__________14/5/03
    4________________Queen__________5/8/07

    I’ve chosen the CD ID field to appear as a hyperlinkfield in the grid view options. I’ve also linked it to a page called CDView.aspx. On that page I hope to show the details of the CD that are stored in the sql database and allow the user to update the information.

    My question is how do I pass the CD ID to the CDView page so I can then load up all the details about the CD? If the user clicks the CD ID link say the number 12 how do I pass that number 12 as an int to the CDViewPage?

    Any help would be great.
    Thanks,
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Create the hyperlink that points to CDView.aspx?CdId=<the cd id>

    E.g.
    CDView.aspx?CdId=12
     
  3. CaJack

    CaJack New Member

    Joined:
    Mar 21, 2007
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    Thanks, for the help. from what you've said I've managed to get it working. Cheers, CaJack
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice