Tuesday, April 5, 2011

How can I create different number of button controls?

I'm printing to the screen lots of entries from my database. I'd like each entry to have it's own button, so I can add that specific entry to my cart (saved in Session[]).

How can I do it? I'd like to have something like this: alt text

Thank you very much!! :)

From stackoverflow
  • Have you had a look at the Repeater Control?

  • Hey,

    You can easily achieve that with a repeater or ListView, put a button in the template and give the button an ID of the backend database entry. When the button is clicked, it fires an event (or if you give a command it fires an ItemCommand event) that you can use to do whatever processing you need...

    HTH.

  • Hello,

    As Brian said, you can add the buttons by using the repeater control. As simple as that.

0 comments:

Post a Comment