如何在表格中添加按钮? [英] how to Add button in table?
问题描述
大家好...香港专业教育学院一直在寻找一些有关如何在表格中添加我自己的按钮的代码?假设我有一个列表视图表,并且在它的单元格内我想添加自己的按钮,并且在另一列上我希望它具有图像?我将如何实现?我知道如何在Java中执行此操作,但现在它的C#我不知道从哪里开始...我是否必须为按钮创建一个类?然后在初始化其内容/值时将其放在表类上?请帮助我...在此先感谢...
顺便说一句,我想将表格放置在窗口形式中,而不是放在网页或其他任何东西上.
Hi guys... ive been trying to look for some code on how to add my own button in a table? let say i have a list view table and inside its cell i want to add my own button and on another column i want it to have images? how will i accomplished that? i know how to do it in java but now that its c# i dont know where to start... do i have to create a class solely for button? and then place it on the table class upon initialization of its content/values? please help me guys... thanks in advance...
By the way i want the table to be place in a window form and not on a webpage or anything...
推荐答案
您可以将gridview与ItemTemplate一起使用
示例代码:
You can use gridview with ItemTemplate
Sample Code:
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" Text="My Button" />
</ItemTemplate></asp:TemplateField>
</Columns>
</asp:GridView>
这篇关于如何在表格中添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!