简体   繁体   中英

Method on master page calling from content page Web Method

I have a method (non static) on master page that will be called from content page Method(static WebMethod) . Eg Master Page:

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

Content Page:

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

Order() (content Page Method) will be called from Jquery ajax and loadcar()(master page function) will be called with in Order() Function.

i need to call master page method from content page. please provide me some solution.

Any Idea please?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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