I am displaying a list of accounts objects in a repeater. Each object contains three fields namely studentID, studentName and studentAge. I have wrapped it with a link button. As a result the each individual item which is displayed is clickable. I have also added a click handler to the link button. The problem is that how am I supposed to know which student was clicked? Because originally I want to navigate to the next page and display that particular student’s details. Once I know which student is clicked then I can store his details in a session object and then navigate to the new page and get it back.
Thanks for your help.
In your case, it would be better to use a normal hyperlink, pass the ID as query string, and have the new page get the details.
Update:
To get the studentID on the same page, use the ItemCommand event instead and have the
LinkButtonas follows:The studentID will be stored into the
CommandArgumentproperty, which value will be passed to theItemCommandevent handler.