【问题标题】:Add buttons to asp:table将按钮添加到 asp:table
【发布时间】:2014-03-23 01:40:39
【问题描述】:

对于这个简单的问题,我很抱歉,但我没有找到答案:

我创建了一个包含一行和两个单元格的 asp:table。如何为每个单元格添加一个简单的按钮? 使用 HTML 表格很简单。您应该从工具箱中拖放。我怎样才能用 and asp table 做同样的事情?

【问题讨论】:

    标签: c# asp.net visual-studio button html-table


    【解决方案1】:

    你可以从后面的代码中:

    foreach (TableRow row in yourTable.Rows)
    {
        foreach (TableCell cell in row.Cells)
        {
            Button btn = new Button();
            btn.Text = "Some Button";
            btn.Click += new EventHandler(btn_Click);
            cell.Controls.Add(btn);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2017-04-09
      • 2017-08-15
      • 2018-06-13
      • 2013-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多