Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NotTooSerious - 27 Apr 2008 17:36 GMT
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] - 27 Apr 2008 17:53 GMT
> 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...?

Signature

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

Fernando Rodriguez - 27 Apr 2008 18:23 GMT
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

> Hi I have just upgraded a project from 2005 net 2.0 frame work to 2008
> net 3.5 frame work
[quoted text clipped - 8 lines]
> How do I declare a sub of a master page which is visible to the conten
> pages please?
Ex glider pilot - 25 May 2008 17:06 GMT
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
[quoted text clipped - 29 lines]
>
> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.