src vs codebehind in <% @Control ... %>

Results 1 to 2 of 2

Thread: src vs codebehind in <% @Control ... %>

  1. #1
    Join Date
    Dec 1969

    Default src vs codebehind in <% @Control ... %>

    I&#039;m creating pages in VS.NET.<BR><BR>When first making a webuser control I can use the designer tab to position and add items to the page together with the codebehind file.<BR><BR>However when I try to run this in a browser from a webform page I get a "Parser Error Message: Could not load type &#039;reg&#039; " (reg is the class name in the codebehind file of the webuser control).<BR><BR>Here is the @ Contol string:<BR>&#060;%@ Control Language="vb" AutoEventWireup="false" codebehind="reg.ascx.vb" Inherits="reg" TargetSchema="" %&#062;<BR><BR><BR>If I now change the @ Control tag in the web form from codebehind="reg.ascx.vb" to src="reg.ascx.vb" then the page works fine in the browser, but now the VS.NET designer doesn&#039;t want to know the .ascx page in design view, only HTML view! <BR><BR>The error message is: "The file failed to load in the web designer. Please correct the following error, then load it again: Visual Studio cannot open a designer for the file because the class within it does not inherit from a class that can be visually designed."<BR><BR>If I now change the @ Control tag back to codebehind="reg.ascx.vb" (from src="reg.ascx.vb") it again doesn&#039;t load in the browser but WILL open in the web designer of VS.NET! <BR><BR>What&#039;s going on?<BR><BR>All suggestions gratefully received.

  2. #2
    Join Date
    Dec 1969

    Default RE: src vs codebehind in <% @Control ... %�

    Not sure if this is any help but I call my code behinds differently then you appear to be doing. I would use:<BR><BR>&#060;%@ Page Inherits="reg" src="reg.vb" %&#062;<BR><BR>Maybe that is to simple for what you are donig though.<BR><BR>Morgan

Posting Permissions

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