开发者

How can I create different number of button controls?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜