I am hoping someone can help me understand what is going on in the code line below:
Table t = (Table)Page.FindControl("Panel1").FindControl("tbl");
I understand Page.FindControl("Panel1").FindControl("tbl");
Why is there a (Table) before the Page.FindControl?
FindControl
is declared to return Control
(at a guess :) whereas you need to store the result in a variable of type Table
.
The (Table)
bit is a cast - it's basically saying, "I think this will be a Table
. Check it for me at execution time, and then let me use it accordingly."