簡體   English   中英

如何在內容頁面中調用母版頁方法,但該方法不是從母版頁繼承的

[英]how to call the master page method in content page but which is not inheritted from the master page

如何在內容頁面中調用母版方法,但內容頁面不是從母版繼承的。 在內容頁面中調用母版頁方法需要做什么

這是我的操作母版頁方法public void RedirectPage(string url){
ifrmMstr.Attributes.Add(“ src”,url);
}

這是我的內容頁面,我正在頁面加載中調用這樣的函數

操作主機= new Operation(); master.rpage( “../ Default.aspx的”);

這有幫助嗎?

https://www.google.co.nz/#q=expose+control+from+master+page+to+content+page

“ ....要從內容頁面訪問母版頁的方法或屬性,請通過Page.Master屬性引用母版頁。此屬性返回類型為MasterPage的對象,因此您需要將其顯式轉換為適當的對象類型,然后再調用@MasterType指令,該指令將屬性添加到自動生成的名為Master的ASP.NET代碼背后類代碼中,該代碼是對指定Master的強類型引用頁....”

這也很有用

如何從子頁面控制asp.net主頁上的元素

您可以通過調用母版頁的JavaScript函數並在客戶端進行操作來從內容頁更改母版頁框架的源。

在您的內容頁面方法(vb.net)中添加以下內容:

    Dim frameSourceMethod As String = String.Format("YourMethod('{0}');",frameSourcePath)
    ScriptManager.RegisterStartupScript(Me, Me.GetType(), "displdcccdsse4errnfokf", frameSourceMethod , True)   

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM