Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

public sub (on master page) not visible after upgrade form 2.0 2005 to 2008 3.5

0 views
Skip to first unread message

NotTooSerious

unread,
Apr 27, 2008, 12:36:38 PM4/27/08
to
Hi I have just upgraded a project from 2005 net 2.0 frame work to 2008
net 3.5 frame work
On the (single not nested) master page I have a lable which is wrapped
in a public sub to set its text and fore colour
The content pages which inherit from the master page do not now see
the public sub and give a compile error

I've deleted the sub saving the project and adding the public sub back
again - no joy

How do I declare a sub of a master page which is visible to the conten
pages please?

Mark Rae [MVP]

unread,
Apr 27, 2008, 12:53:21 PM4/27/08
to
"NotTooSerious" <ia...@ava.co.uk> wrote in message
news:ad5414d6-28db-451b...@24g2000hsh.googlegroups.com...

> The content pages which inherit from the master page

The content pages inherit from the MasterPage?

> do not now see the public sub and give a compile error

And what is the compile error?

> How do I declare a sub of a master page which is visible to the content
> pages please?

Have you forgotten to reference the Master Page through the Page.Master
property or set the @MasterType directive in the aspx file...?


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Fernando Rodriguez

unread,
Apr 27, 2008, 1:23:14 PM4/27/08
to
I may be confused, but Content pages do not inherit from Master pages, not
even in 2.0. To access a method on the master page from you content page you
need to do use the Master property on the content page, which will return an
instance of your master page that you need to cast to the actual type of
your master page before you can call the method (actually VB may let you
call it without casting but in order to see it on intellisense you need to
cast it as follows:

If TypeOf Me.Page.Master Is MyMasterPageType Then

CType(Me.Page.Master, MyMasterPageType).MyPublicMethod()
End If

If that's not what you're trying to do please post some code samples so I
can get a better idea.

Hope that helps,
Fernando Rodriguez


"NotTooSerious" <ia...@ava.co.uk> wrote in message
news:ad5414d6-28db-451b...@24g2000hsh.googlegroups.com...

Ex glider pilot

unread,
May 25, 2008, 12:06:51 PM5/25/08
to
On Apr 27, 6:23 pm, "Fernando Rodriguez"

<frodrig...@mcp.microsoft.com> wrote:
> I may be confused, but Content pages do not inherit from Master pages, not
> even in 2.0. To access a method on the master page from you content page you
> need to do use the Master property on the content page, which will return an
> instance of your master page that you need to cast to the actual type of
> your master page before you can call the method (actually VB may let you
> call it without casting but in order to see it on intellisense you need to
> cast it as follows:
>
> If TypeOf Me.Page.Master Is MyMasterPageType Then
>
>     CType(Me.Page.Master, MyMasterPageType).MyPublicMethod()
> End If
>
> If that's not what you're trying to do please post some code samples so I
> can get a better idea.
>
> Hope that helps,
> Fernando Rodriguez
>
> "NotTooSerious" <i...@ava.co.uk> wrote in message

>
> news:ad5414d6-28db-451b...@24g2000hsh.googlegroups.com...
>
>
>
> > Hi I have just upgraded a project from 2005 net 2.0 frame work to 2008
> > net 3.5 frame work
> > On the (single not nested) master page I have a lable which is wrapped
> > in a public sub to set its text and fore colour
> > The content pages which inherit from the master page do not now see
> > the public sub and give a compile error
>
> > I've deleted the sub saving the project and adding the public sub back
> > again - no joy
>
> > How do I declare a sub of a master page which is visible to the conten
> > pages please?- Hide quoted text -
>
> - Show quoted text -

0 new messages