N
Nehal Shah
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.WebUserControl1) is not compatible with the type of control
(ASP.WebUserControl1_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 programmatically.
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.aspx.vb"
Inherits="WebForm1"%>
<%@ Register TagPrefix="uc1" TagName="WebUserControl1"
Src="WebUserControl1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<form id="Form1" method="post" runat="server">
<uc1:WebUserControl1 id=uc runat="server"
txt="source"></uc1:WebUserControl1>
</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="WebUserControl1.ascx.vb" Inherits="WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<span>Santa Clause doesn't exist.</span>
Thanks,
Nehal
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.WebUserControl1) is not compatible with the type of control
(ASP.WebUserControl1_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 programmatically.
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.aspx.vb"
Inherits="WebForm1"%>
<%@ Register TagPrefix="uc1" TagName="WebUserControl1"
Src="WebUserControl1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<form id="Form1" method="post" runat="server">
<uc1:WebUserControl1 id=uc runat="server"
txt="source"></uc1:WebUserControl1>
</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="WebUserControl1.ascx.vb" Inherits="WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<span>Santa Clause doesn't exist.</span>
Thanks,
Nehal