Last post Aug 31, 2010 08:46 PM by rajasp
Aug 31, 2010 05:54 PM|rajasp|LINK
I have an ASP.net control that contains a grid (protected member variable). Grid is populated from a function in the control. I have derived a new user control from this control without any control in it. I added additional functionality to populate grid
and called base class function to do further operation on the grid.
When I run my code, I get the null reference exception on grid object in the base control.
Any idea why this might happen? Am I missing something in control inheritance? at what point do inner controls get created?
control Inheritance null pointer exception custom control
Aug 31, 2010 08:46 PM|rajasp|LINK
I think I figured out the issue. It looks like when an user control (with other control(s) in it) is inherited, inner controls are not get inherited. So I copied all the code in .ascx file (grid and other HTML) of base control in derived control's ascx file.
That fixed my problem.
Can someone provide more details on why visual inheritance I was looking for is not provided?
user control visual inheritance object reference not set exception inner controls