I've read that in the Page Directive of an aspx page, changing the
CodeBehind attribute to Src saves you from having to compile the page before
refreshing. This is preferable in a large development environment where
rather than having each developer running a local copy of a website, they
can make changes simultaneously to a central web server without stepping on
each other's toes as far as compilation is concerned.
ANYWAY, this is fine for aspx files, but when you try this with ascx files
(user controls), I get the following error:
The base class includes the field 'uc', but its type
(TestWeb.WebUse rControl1) is not compatible with the type of control
(ASP.WebUserCon trol1_ascx).
It seems to be having a problem with the declaration of the user control on
the CodeBehind of the containing aspx page. When I remove it, it works
fine. But then I can't really do anything with it programmaticall y.
Does anyone know how to make it work so that I can declare and manipulate
the user control in the CodeBehind under these circumstances?
HERE'S THE ASPX PAGE:
<%@ Page Language="vb" AutoEventWireup ="false" Src="WebForm1.a spx.vb"
Inherits="WebFo rm1"%>
<%@ Register TagPrefix="uc1" TagName="WebUse rControl1"
Src="WebUserCon trol1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<form id="Form1" method="post" runat="server">
<uc1:WebUserCon trol1 id=uc runat="server"
txt="source"></uc1:WebUserCont rol1>
</form>
</body>
</html>
I ADDED THE FOLLOWING DECLARATION TO THE "Web Form Designer Generated Code"
REGION OF THE ASPX CODEBEHIND:
Protected WithEvents uc As WebUserControl1
HERE'S THE USER CONTROL:
<%@ Control Language="vb" AutoEventWireup ="false"
Src="WebUserCon trol1.ascx.vb" Inherits="WebUs erControl1"
TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5" %>
<span>Santa Clause doesn't exist.</span>
Thanks,
Nehal