【问题标题】:Method on master page calling from content page Web Method从内容页面 Web 方法调用母版页上的方法
【发布时间】:2017-11-11 17:54:48
【问题描述】:

我在母版页上有一个方法(非静态),将从内容页 Method(static WebMethod) 调用。 例如 母版页:

public partial class User : System.Web.UI.MasterPage
{ 
public void loadcart()
{
 //some code here that i will a div
}
}

内容页面:

public partial class Menu : System.Web.UI.Page
{
[webMethod]
public static void Order()
{
// some code here
// call Master page method from here
}
}

Order()(内容页面方法)将从 Jquery ajax 中调用,loadcar()(母版页函数)将在 Order() 函数中调用。

我需要从内容页面调用母版页方法。请给我一些解决方案。

有什么想法吗?

【问题讨论】:

标签: c# asp.net


【解决方案1】:

例如,如果您想调用 loadcart,您可以执行母版页转换。

           (this.Master as SiteMaster).loadcart();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多