2005 problems with "Register TagPrefix" and Partial Public Classes

PaTRiCKDRD
01-19-2007, 05:59 PM
Hi all!

After having worked with .net 2003 for a while,
I had to switch to .net 2005 for my new job,
so I though to port my old job's site to .net 2005,
however, I am facing some problems:

1)

<%@ Register TagPrefix="uc1" TagName="GroupTabs" Src="~/baseControls/GroupTabs.ascx" %>

doesn't work,
because on the line (same file):
<uc1:GroupTabs id="ctl_GroupTabs" runat="server"></uc1:GroupTabs>

I get the message:

"Error 2 Name 'ctl_AppTabs' is not declared."


What on earth is going on?
This code was working flawlessly in .net 2003!

2) When trying to establish a reference between two partial public classes (ascx files),
I get the error
Type 'Header' is not defined
(Header is the other page)

3) How am I supposed to split a table using a master page, when it should have open tags in the header section, which would close in the footer section, but .net 2005 doesn't let me compile?

Thanks in advance!

PaTRiCKDRD
01-19-2007, 06:56 PM
I just found out that the 1st issue had to do with the second, I had a syntax error in this specific file, so,
how can I get a reference to the other ascx?

Does anyone know?

wayneph
01-21-2007, 08:56 AM
Apparently I'm missing something... The Partial classes shouldn't affect anything. In the long run any Partial chunks get put back together and it works just like any other class.

What line of code gives you the "Type 'Header' is not defined" message? Maybe if we can see more of what you're trying to do, we could help more.

3. My first thought is that you're thinking too much like classic ASP. You shouldn't need to have your opening and closing tags in different controls. In a MasterPage you should be able to put the entire outer table. Then in your controls just put content.

PaTRiCKDRD
01-22-2007, 07:48 PM
first file:

Partial Public Class Header
Inherits BaseControl


second:

Partial Public Class AppTabs
Inherits BaseControl

Dim hd As Header = CType(Page.Controls(0), Header)


When I write "Dim hd As " and hit Ctrl+Space (autocomplete),
"Header" is not shown!

Tried that using an empty web site with two partial public classes and couldn't make it work!

wayneph
01-23-2007, 08:18 AM
Are these UserControls (.ascx and .ascx.vb files) or Custom Server Controls (just a .vb file)?

I assume since it's a partial class that it's an ASCX User Control...
I just tried it and in order to reference Header directly, I had to register the Header Control in the AppTabs Control. <&#37;@ Register Src="Header.ascx" TagName="Header" TagPrefix="uc1" %>

PaTRiCKDRD
01-23-2007, 08:40 AM
I defined classname as somebody suggested,
but now got 'circular reference' error!


<&#37;@ Control Language="vb" AutoEventWireup="false" CodeFile="Header.ascx.vb" Inherits="Header" CodeFileBaseClass="BaseControl" ClassName="Header" %>"uc1" TagName="GroupTabs" Src="~/baseControls/GroupTabs.ascx" %> <%@ Register TagPrefix="uc1" TagName="GroupTabs" Src="~/baseControls/GroupTabs.ascx" %>
<td id="td_GroupHeaders"><uc1:GroupTabs id="ctl_GroupTabs" runat="server"></uc1:GroupTabs></td>



Public Class Header
Inherits BaseControl



<%@ Control Language="vb" AutoEventWireup="false" CodeFile="GroupTabs.ascx.vb" Inherits="GroupTabs" CodeFileBaseClass="BaseControl" %>

<%@ Reference Control="Header.ascx" %>



Dim hd As Header = CType(Page.Controls(0), Header)

wayneph
01-23-2007, 08:46 AM
What are you trying to do? No code, just concepts. I think you've got this Object Oriented programming model all backwards.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum