문제

I am (unfortunately) updating a DotNetNuke 5 desktop module

I have a button handler:

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

I have also tried the above using NamingContainer - but both options are throwing this error at me:

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

How can I retrieve the table cell that the button lives in?

도움이 되었습니까?

해결책

You have to cast it :

TableCell tblCell = (TableCell)button.Parent;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top