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

  • Thread starter Thread starter vndaxanh
  • Start date Start date
V

vndaxanh

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
 
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)
 
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.
 
Back
Top