Saturday, June 18, 2011

Page is null at the c# class library control

Hi all.
Just caught up in the mess when I came to see : the parent page of one of my class library control was null at runtime. That means the call:
would fail.

I have been suggested this happens when my parent page is being rendered within an iframe. But this was not the case for now. I was just using a placeholder to dynamically add the control. So what's the solution?

Yes it came around after some googling, try this:


What's in here?

The Page that refers to the Page control containing this dynamic control is achieved through current request handler. This avoids the problem since the request was generated by the page. But mere Page or this.Page or this.Parent.Page or whatsoever might have been missed due to the hierarchy of the controls or is it due to anything else?

Hope this helps. Sweet programming!


Post a Comment

Hope you liked this post. You can leave your message or you can put your valuable suggestions on this post here. Thanks for the sharing and cooperation!

Popular Posts

Recent Articles