English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

If I create a public class in a Masterpage, is that class available to work with in Content pages that are created using that Masterpage? If there has been an object created with one of those classes in the Masterpage, can it be referenced directly in the Content page, or must a new object be instantiated?

2007-03-28 04:09:02 · 1 answers · asked by Michael B 3 in Computers & Internet Programming & Design

1 answers

You should not be defining classes inside of a MasterPage class. There are very, very few situations where this is an appropriate solution. It is very easy to reference public properties and methods on a master page from the content page like so:

c#:
( ( MasterPageClassName )this.Master ).PropertyOrMethod()

Or in VB.NET:
CType(this.Master, MasterPageClassName ).PropertyOrMethod()

2007-03-28 08:24:47 · answer #1 · answered by Rex M 6 · 1 0

fedest.com, questions and answers