Harshit Tailor Harshit Tailor - 2 months ago 7
Vb.net Question

Access Master Page Method in asp.net c#

How should I access public methods of master page from a child page?

UserMaster.master.vb

Public Sub UpdateCart()
End Sub


Default.aspx.cs

How can I access
UpdateCart()
from the Default.aspx.cs page?

Answer

From you Content page you can use this to achieve the requirement :

VB

TryCast(Me.Master, MyMasterPage).UpdateCart()

C#

(this.Master as MyMasterPage).UpdateCart();
Comments