[英]How can I retrieve a cell containing a button?
我(不幸的是)正在更新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'
如何檢索按鈕所在的表格單元格?
您必須強制轉換:
TableCell tblCell = (TableCell)button.Parent;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.