ASP.Net : How to call a Master page event handler from Content page event handler?

前端 未结 3 1352
慢半拍i
慢半拍i 2020-12-18 10:13

I have a master page where in I have a link button. In one of the content pages, I need to hide the linkbutton and replace with image button. The click event handler for ima

3条回答
  •  生来不讨喜
    2020-12-18 10:51

    If your Master Page is MyMaster, make a property like this:

    Public Shadows ReadOnly Property Master() As MyMaster
        Get
            Return CType(MyBase.Master, MyMaster)
        End Get
    End Property
    

    Then whatever you want to access in the Master Page, make sure it's Public, and you will be able to access it via:

    Master.xxxx
    

提交回复
热议问题