Results 1 to 8 of 8

Thread: [Resolved] Get ID from Data grid when user clicks on hyperlink button

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Resolved [Resolved] Get ID from Data grid when user clicks on hyperlink button

    I have a datagrid that has several columns and several records. The last column (column7) has the ID of the record. When the user clicks the hyperlink button, I want to put the ID of the record into a session variable for use in the next web page.

    Anyone have any ideas?

    Thanks
    Last edited by indydavid32; Feb 2nd, 2005 at 03:56 PM.
    David Wilhelm

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: Get ID from Data grid when user clicks on hyperlink button

    Is it a hyperlink button managed by the DataGrid or one of your own?
    Magiaus

    If I helped give me some points.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Re: Get ID from Data grid when user clicks on hyperlink button

    It is a hyperlink that is a part of the datagrid.
    David Wilhelm

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: Get ID from Data grid when user clicks on hyperlink button

    Do you have a Command Name set for it? If you do you can use Command event and the event args.

    e.Item.Cells(7).Text = your key
    Magiaus

    If I helped give me some points.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Re: Get ID from Data grid when user clicks on hyperlink button

    What sub would I use where that code would run when they click on the hyperlink? I tried DataGrid1_SelectedIndexChanged and it didn't run.
    David Wilhelm

  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: Get ID from Data grid when user clicks on hyperlink button

    ItemCommand
    Magiaus

    If I helped give me some points.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Re: Get ID from Data grid when user clicks on hyperlink button

    I put some code there and a stopper and it did not run when I clicked the hyperlink button.
    David Wilhelm

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Resolved Re: Get ID from Data grid when user clicks on hyperlink button

    I got it. I used Select and then put the code in SelectedIndexChanged and it worked great.

    Thanks for you help.
    David Wilhelm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width