[英]How to call MasterPage from c# class
在我的 asp.net 項目中,我有一個 MasterPage 和一個名為Resources.cs
的額外 C# 類。 在 MasterPage 中,我有一個模式,我試圖用它來顯示錯誤消息。 我從回溯代碼顯示模態的方式是:
ScriptManager.RegisterStartupScript(this, this.GetType(), "PopModal", scriptModal, true);
首先, this
引用了腳本將執行的頁面,我不知道如何從Resources.cs
引用我的 MasterPage。 任何的想法?
如果要在類中使用 ScriptManager,則不需要母版頁。
Page page = HttpContext.Current.CurrentHandler as Page;
ScriptManager.RegisterStartupScript(page, page.GetType(), "PopModal", scriptModal, true);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.