c# - Get Parent of custom TextBox control -


when creating custom control extends textbox, inside oncreatecontrol() override, parent null. when extending other controls such button, isn't null. checking following code , adding form , various container controls:

protected override void oncreatecontrol() {     base.oncreatecontrol();     messagebox.show((parent == null).tostring()); //true when extending textbox, false when extending button } 

what can retrieve parent of control when added control, ensuring same code work regardless of control extend?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -