1。先在页面上放个panel
<
asp:Panel ID
=
"
Pnlshow1
"
runat
=
"
server
"
Height
=
"
20px
"
Width
=
"
600
"
>
</
asp:Panel
>
2。生成按钮
Salontype salontype
=
new
Salontype();
<
asp:Panel ID
=
"
Pnlshow1
"
runat
=
"
server
"
Height
=
"
20px
"
Width
=
"
600
"
>
</
asp:Panel
>
Salontype salontype
=
new
Salontype();
这篇博客介绍了如何在ASP.NET中动态生成按钮,并为每个按钮添加点击事件。通过在页面上放置一个Panel,然后在循环中创建LinkButton对象,设置按钮文本、ID和CommandArgument属性。每个按钮的Click事件都绑定了同一个方法doArtstyle,该方法接收sender参数以获取被点击按钮的CommandArgument,用于进一步的操作。
最低0.47元/天 解锁文章
898

被折叠的 条评论
为什么被折叠?



