繁体   English   中英

从内容页面Web调用母版页的方法

[英]Method on master page calling from content page Web Method

我在母版页上有一个方法(非静态),该方法将从内容页面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
}
}

将通过Jquery ajax调用Order()(内容页面方法),并使用Order()函数中的loadcar()(母版页函数)进行调用。

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

有任何想法吗?

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM