datagrid - get the row's column value when clicking on a hyperlink cell

Discussion in 'ASP .Net' started by vndaxanh@yahoo.com, Jan 23, 2006.

  1. Guest

    Hi everyone,

    I have an aspx page with a datagrid column which bound to a dataset at
    page_load. It contains 2 columns, Key and Hyperlink. What I want to
    do is when I click on the hyperlink it will set a session variable to
    the Key column like so:

    Session["SomeKey"] = column 0 of row of the hyperlink clicked on.

    How do I do this? Thanks in a advance for your help!

    Hanna
     
    , Jan 23, 2006
    #1
    1. Advertising

  2. Bruce Barker Guest

    you need to change the hyperlink to a link button, and on the postback use
    the Redirect method to do the link.

    -- bruce (sqlwork.com)

    <> wrote in message
    news:...
    > Hi everyone,
    >
    > I have an aspx page with a datagrid column which bound to a dataset at
    > page_load. It contains 2 columns, Key and Hyperlink. What I want to
    > do is when I click on the hyperlink it will set a session variable to
    > the Key column like so:
    >
    > Session["SomeKey"] = column 0 of row of the hyperlink clicked on.
    >
    > How do I do this? Thanks in a advance for your help!
    >
    > Hanna
    >
     
    Bruce Barker, Jan 23, 2006
    #2
    1. Advertising

  3. Guest

    Thanks for your reply, Bruce.

    However, I can get the link to work properly. My problem is that I
    don't know how to get the value of the Key column once I've clicked the
    hyperlink. The hyperlink takes me to another page, but before it does
    I need to set a session variable to the Key column of the selected
    hyperlink.

    this is my datagrid for example:

    Key Link
    1 descriptionA
    2 descriptionB
    3 descriptionC

    When I click on descriptionB, before it takes me to another page I want
    to get the value 2 out and put that value into a session variable.
     
    , Jan 23, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF1bA==?=

    datagrid-how to get cell value(hyperlink column)

    =?Utf-8?B?UGF1bA==?=, Oct 12, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    8,928
    =?Utf-8?B?UGF1bA==?=
    Oct 13, 2004
  2. TB
    Replies:
    0
    Views:
    505
  3. davetichenor
    Replies:
    1
    Views:
    884
    Eliyahu Goldin
    Oct 30, 2006
  4. Dave
    Replies:
    0
    Views:
    978
  5. Sameeksha
    Replies:
    0
    Views:
    124
    Sameeksha
    Apr 7, 2005
Loading...

Share This Page