【问题标题】:How can I retrieve a cell containing a button?如何检索包含按钮的单元格?
【发布时间】:2014-02-14 15:20:21
【问题描述】:

我(很遗憾)正在更新 DotNetNuke 5 桌面模块

我有一个按钮处理程序:

protected void ButtonHandler(object sender, EventArgs e)
{
    Button button = (Button)sender;
    TableCell tblCell = button.Parent;
}

我也尝试过使用 NamingContainer 进行上述操作 - 但两个选项都向我抛出此错误:

Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.TableCell'

如何检索按钮所在的表格单元格?

【问题讨论】:

    标签: c# asp.net dotnetnuke-module dotnetnuke-5


    【解决方案1】:

    你必须投射它:

    TableCell tblCell = (TableCell)button.Parent;
    

    【讨论】:

      猜你喜欢
      • 2022-01-10
      • 1970-01-01
      • 2020-08-31
      • 2019-10-01
      • 1970-01-01
      • 2020-11-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多