Error Creating Control in VS, even though designer

Results 1 to 4 of 4

Thread: Error Creating Control in VS, even though designer

  1. #1
    Join Date
    Dec 1969

    Default Error Creating Control in VS, even though designer

    When I drag a custom control that I created onto my page, all I get is a gray text box reading "Error Creating Control." When I hover my mouse over the control, the tool tip says "Object reference not set to an instance of an object." I have a designer created for the control, and at one point in time the designer HTML was showing up, but I made some changes to my control and now the designer code won&#039;t show up. Why won&#039;t VS just ignore any "errors" it detects in the control and just show the designer? I thought that was the point of the designer.<BR><BR>(BTW, the control works just fine when I run the project.)

  2. #2

    Default RE: Error Creating Control in VS, even though desi

    The designer isn&#039;t used at runtime.<BR><BR>Wrap a try catch block around whatever code you have in GetDesignTimeHtml and return the error message.<BR>

  3. #3
    Join Date
    Dec 1969

    Default Fixed, thanks for looking

    Yeah, I know the designer isn&#039;t used at runtime. Everything was working fine at runtime. It was at design-time that everything was going down the tubes. I just was wondering why it was even concerned with the code of the control itself; I thought it should have just been grabbing the code I return from GetDesignTimeHtml (which is nothing but a big HTML string) and dumping that in the designer.<BR><BR>Anywho, by process of elimination, I found where the problem was. I was declaring a global variable for an object my coworker created, and instantiating the object where it was being declared. When I commented out that line, the designer code showed up in VS as expected. I then moved the instantiation of the object in question to the OnInit method and everything seems fat and happy. The funny thing is, until yesterday afternoon the code was working fine. My coworker did create a new version of the object yesterday, but neither of us can figure out what changed in his object to cause the problem.<BR><BR>Anyway, thanks for looking.

  4. #4

    Default RE: Fixed, thanks for looking

    A lot of things for design are not created at constrution time, they can only be used after everything is initialized and Site-ed.<BR><BR><BR>The base implementation of GetDesignTimeHtml calls the control&#039;s Render method.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts