Quote:
Unable to cast object of type 'System.Web.UI.WebControls.Label' to type 'System.Web.UI.WebControls.TableCell'.
Well there are two places where that error could occur, and they both refer to the same control:
(TableCell)dataItem.FindControl("lbl_EmpNumber")
You haven't shown any of your markup, but the error is telling you that your
lbl_EmpNumber
control is a
Label
. You cannot cast a
Label
instance to a
TableCell
.
But even if you could, what you're doing wouldn't make any sense; you're trying to increase the row-span on a control which you have set to be invisible
(ie: not rendered) on the previous line!