Reputation: 75
I am a newbie and I have spent well over 100 hours trying to find a solution to my question:
I have a Recipes db which is displayed in Recipes ListView that gives 13 rows of data. The Recipes db loads into Recipes ListView just fine and the Recipes db has a relational db named RecipesDirections. Each db has a primary key of "Category" and the RecipesDirections has a foreign keu to Recipes db which is "Category". "Category 1", etc., is the same recipe(s) in both db. The Recipes ListView shows the first ten names of recipes from the Recipes db. I would like to click on the 1st name in the Recipes ListView and have a page open (I'm using DetailPage.aspx as this page) showing the same recipe (which has ingredients and directions) from the RecipesDirections db.
DetailPage.aspx does show the ingredients and directions, for 10 recipes, in a ListView from the RecipesDirections db if opened in a browser.
My goal is to be able to click on recipe #1 or recipe #2, or recipe #10 on the Recipes ListView and have that recipe with ingredients and directions open in the DetailPage.aspx. Right now, regardless of the link I click (1 through 10) on the Recipes List View, the DetailPage.aspx opens and displays only the 1st recipe of the RecipesDirections db.
Any help would be greatly appreciated.
Upvotes: 0
Views: 435
Reputation: 1577
Before you databind with the ListView you will need to make sure there is a key that identifies the Recipe in the data.
In your ListView when you form the link to DetailPage.aspx you will need append a query string variable to identify the Recipe you are trying to view.
In DetailPage.aspx, extract the variable from the query string and use it to query the database table for the Recipe details.
Upvotes: 2