1

I'm working on my first asp.net/web development application. Obviously, I'm very new to asp.net development, but I've been doing C# for quite some time and so can rationalize out the logic of the project pretty easily. However, I'm struggling with some markup issues I'm working on. Here's my situation:

I have a List of Book objects and each object has a Title and CoverImage property. Okay. I want to display each book as an ImageButton with a border that'll change colors to 'highlight' the one a user clicked. Actually, this doesn't have to be done with an ImageButton, but that's what I've been attempting to use up to this point. Users can only have one book selected at a time. Now, I think I can handle the logic of 'radio-buttoning' the books, however, I'm struggling to figure out how to properly display these 'buttons'. Finally, there will be a normal button below the grid of books that will allow users to submit their selection and I need to make sure I can determine exactly which book is selected (perhaps by getting the Title of the Book object selected?). This is another area where I've been having trouble as I've attempted to do this with a GridView.

Using a GridView control, I've found that by binding a List to the GridView, I can only do a row for each Book rather than a "column" for each. At least, using the only methods I know at this time. Also, I need the UI to be 'smart' enough to dynamically change the number of Books displayed in a row based on the image/browser width.

Please, any advice or tips on how I might achieve this type of interface would be much appreciated. Even better would be some examples or links with examples as I definitely learn best when I can see example code and rationalize my way through it. Below I put a [colored] wire-frame type of image of what I'm attempting to achieve.

enter image description here

1

1 Answer 1

1

Try using an ASP.Net ListView control. It should allow you the layout you request with multiple Books per row.

Sign up to request clarification or add additional context in comments.

1 Comment

Nice! I was getting ready to ask you how to make the DataList control 'wrap' my row of Books, but the ListView is working PERFECTLY! Thanks! My one question is: since each book is actually an ImageButton, will I be able to look at the click event handler and get the Book object from, presumably, the 'sender'? Also, how can I add the padding (which I need to change the color of when a book is 'selected') around each book? Should I put the ImageButton in another control and then have THAT control repeat? Something like a 'pane'?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.