I'm assuming that you're able to get back your data from a
database somehow if that's your data source. I'm practicing some separation of
concerns even though in this case I'm working in a Web Forms application, which
means that my data access lives somewhere else, and within my page I have a
ViewModel class that has no external dependencies (it's really just a state bag
or Data Transfer Object/DTO) that I'll be using for my data binding. The
ViewModel class includes all of the dynamic data elements my page needs to
display, and in this case I've put the ViewModel class inside of my codebehind
class, but that's just a matter of convenience in this case, and not necessarily
a best practice (particularly if you're going to populate the ViewModel from
outside of your codebehind class).
For demo purposes, I'm going to use some hard-coded book
data. These are some books I recommend, by the way. Here's the code that gives
me my data - you can see that each Book object includes the Title, Author name,
Price, and URL to purchase the book in question:
