2011-07-21 61 views
0

所以我有一個具有以下功能ASP.NET VS2008調用從母版頁函數內部模板

'# Get and/or Set the Page ID 
Public Property GetPageId() As String 
    Get 
     Return pgId 
    End Get 
    Set(ByVal value As String) 
     pgId = value 
    End Set 
End Property 

在我的模板,然後母版頁即Default.aspx的誰引用了母版頁如下

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/LoggedIn.Master" CodeBehind="Content.aspx.vb" Inherits="udpharmalecheile.WebForm2" %> 

我該如何調用這個masterpage函數?

回答

0

在我的測試,我的母版是一個名爲站點1類,按當前的名稱替換它,它應該工作:

Dim myMaster As Site1 = Master 
    Response.Write(myMaster.GetPageId) 

克萊頓