ASP.Net 2.0 Vb Root Namespace with MasterPage

G

gabe

Hi,

We have a number of projects that will use the default 'Root
Namespace' option in the project properties box. There will be a
common Master Page that will be used among the projects. I'd like to
be able to use the master page without including the root namespace in
the masterpage Page declaration. In the example below, 'TESTApp' is
the default Root namespace (the name of the project)

<%@ Page Language="vb"
AutoEventWireup="false"
MasterPageFile="~/Site3.Master"
CodeBehind="WebForm1.aspx.vb"
Inherits="TESTApp.WebForm1"
title="Untitled Page" %>

-----------------------------
<%@ Master Language="VB"
AutoEventWireup="false"
Codefile="~/Site3.master.vb"
Inherits="test.Site3" %>
--------------------------------



I can get it to compile by using the Codefile attribute. However, if I
try to create public property on the MasterPage, and use the
<%@ MasterType VirtualPath="~/Site3.Master" %>
or to Type it directly, I get a run time error stating that it the
following
----------------------------------------------------------------------------------------------------
Additional information: Unable to cast object of type
'ASP.site3_master' to type 'TESTApp.test.Site3'.
----------------------------------------------------------------------------------------------------

CType(Page.Master, test.Site3).ButtonText = "asdf"

Is there a way to do this without just removing the project 'Default
Namespace'? Or override if for the that page, and not include ti?

Thanks in advance,

Gabe
 
G

Guest

Hi

if you didn't notice
one of the comments that the compiler tells you is
that the fact that you've added the Namespace test in the
begining of the code file of the master page
caused it to be a sub name space to the Root NameSpace
which is the name of the application "TESTApp"
I VB.NET as far as I know it's impossible override/workaround it
in C# it is

Adlai
---------------------------------
If my answer helped you please press "Yes" bellow


Adlai Maschiach
http://blogs.microsoft.co.il/blogs/adlaim/
 
M

msustrick

Hi

if you didn't notice
one of the comments that the compiler tells you is
that the fact that you've added the Namespace test in the
begining of the code file of the master page
caused it to be a sub name space to the Root NameSpace
which is the name of the application "TESTApp"
I VB.NET as far as I know it's impossible override/workaround it
in C# it is

Adlai
---------------------------------
If my answer helped you please press "Yes" bellow

Adlai Maschiachhttp://blogs.microsoft.co.il/blogs/adlaim/













- Show quoted text -

Thank you. It still does it. I've been working with it some more, and
still couldn't figure out a way to do it. I agree that I don't think
it's possible in VB.

I am curious though, how would you do it in C#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top