I have a masterpage that dynamically loads a usercontrol. The masterpage has a public method that raises a public event. I want the usercontrol to call that method to raise the event so the web page can respond to it. Unfortunately, I can't get my usercontrol to recognize the masterpage method. It says my method is not a member of System.Web.UI.MasterPage.
Here's my masterpage code:
Partial Class Master_Mobile
Public Event Login()
Public Sub RaiseLogin()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Create Dynamic Controls
If ShowLogin And Me.MasterLogin.Controls().Count = 0 Then
Dim ucLogin As UserControl = LoadControl("~/UserControls/Login.ascx")
Here's my usercontrol code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
' Return to caller
Call Page.Master.RaiseLogin() ' THIS LINE FAILS
What's the correct way to call the public method from this dynamically loaded usercontrol? Thanks in advance.