There are several ways of doing this.
Method 1:
While Designing the grid, You can add a Hyperlink column and mention the url in the sql statemetnt. You need to construct the SQL statement in such a way that it also contains a column containing the URL which you want to do the redirect. You can also add the TopicID as the query string.
Select TopicID, TopicName, '../Topics/TopicDetails.aspx?' + Cast(TopicID as Varchar) As URL From Topics
This can be the query for your grid and when you populate the grid, you add this url as the url of the hyperlink column.
Method 2:
You can add a template column and inside that template column add a linkbutton adn pass the TopicID as the CommandArgument to the OnCommand event of the linkbutton. In the OnCommand event, you can add code to redirect to the desired url with the TopicID as the querystring.
Regards
Ganesh
|