Using a custom user control from compiled dll. RRS feed

  • Question

  • User216680051 posted

    Hello. I was having problem with my user controls when I tried to register them in the web.config file because sometimes they weren't updated in the design.cs and the intellisense appeared depending on his own will. So I decided to compile the controls into a different application and reference the dll in the previous app. When it runs I get error saying that the Object reference not set to an instance of an object. How do I solve this problem to run the application properly?

    Thank you very much.

    PS: I saw that what is happening is that when the code runs and it tries to set the first property of some object inside the user control it wan't instatiated yet and throw the error. I could solve the problem if in the construtor I could set something similar as InitializeComponent() so all the objects inside the userControl would be already instatiated and then I could access their properties.

    Wednesday, February 24, 2010 9:41 AM


  • User216680051 posted

    Humm. It seems that it's not possible because not even the user control has the clientId yet and the objects are instatiated when the page is rendered. So what can be done is set the properties inside the event Page_Load().

    Thank you for visiting my thread. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 24, 2010 11:56 PM