I want to output a list of news headlines that are clickable. So far I can get it to print out a list of headlines because I dragged and dropped the NewsHeadline table in d
Something like this will work fantastic as a solution in Visual Studio 2010.
GridView in the Designer tab of your webpage in VS.GridView and click the arrow that appears in the top right.SELECT News_Id, NewsHeadline FROM NewsHeadlineSqlDataSource which is now the DataSource of your GridView.GridView in the Source tab and replace with the following code.Code:
And you're all set. This will create a list of all the Headlines as hyperlinks with a dynamically generated unique link to the newsdetails.aspx page compliments of the query string we built using the PRIMARY KEY News_Id corresponding to each NewsHeadline entry in the NewsHeadline table.
Then when you load the newsdetails.aspx page you use: Request.QueryString["News_Id"] to get the News_Id value from the URL and use it to query the database for the details about the specific NewsHeadline that was clicked. You can then display the result of that query on the webpage.