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

  • Thread starter Thread starter NotTooSerious
  • Start date Start date
N

NotTooSerious

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?
 
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
 
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








- Show quoted text -
 
Back
Top