Results 1 to 2 of 2

Thread: get error in IDE when try to view ASPX designer page *RESOLVED*

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Resolved get error in IDE when try to view ASPX designer page *RESOLVED*

    Error: "The file could not be loaded into the web forms designer"

    I have a class called ApplesBase:
    VB Code:
    1. Public Class ApplesBase
    2.     Inherits System.Web.UI.Page
    3.  
    4.     Public Sub New()
    5.        Call LinkToApples
    6.     End Sub
    7.  
    8.     Private Sub LinkToApples()
    9.         'code here to do stuff
    10.     End Sub
    11. End Class
    My web pages now inherit from this:
    VB Code:
    1. Public Class EnteringSite
    2.     Inherits ApplesBase
    3.  
    4.     'code for web page
    5. End Class
    Now the problem occurs when I try to view the designer in the IDE for any web page that inherits ApplesBase.
    The error I am getting is in the screenshot.
    If I remark out the Call LinkToApples line from the ApplesBase class then it works. but I need this code here.

    The problem is that adding break points doesn't help as it seems to not link the code to the IDE, or something.

    Anyways, I have been told that I can do an If blah Then type statement in my New sub so that I can only execute the code when not running in the IDE.

    Make sense???

    Woof
    Attached Images Attached Images  

  2. #2

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Web Page inherits a class, but get error in IDE when try to view ASPX designer page.

    Fixed it.
    VB Code:
    1. Public Sub New()
    2.         Dim DesignMode As Boolean = (HttpContext.Current Is Nothing)
    3.  
    4.         If Not DesignMode Then
    5.             Call LinkToApples()
    6.         End If
    7.  
    8.     End Sub
    Using the above in ApplesBase class means the code doesn't get executed at design time.

    Woka

Posting Permissions

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



Click Here to Expand Forum to Full Width