开发者

How can I create different number of button controls?

开发者 https://www.devze.com 2022-12-24 20:37 出处:网络
I\'m printing to the screen l开发者_开发知识库ots 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[]).

I'm printing to the screen l开发者_开发知识库ots 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:

How can I create different number of button controls?

Thank you very much!! :)


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.


Have you had a look at the Repeater Control?

  • Repeater Class
  • ASP.NET Repeater control instead of grid


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号