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

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
 
B

Bruce Barker

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)
 
V

vndaxanh

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top