How to a call a function from a user control's parent page ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: grist2mill (grist2mill_at_excite.com)
Date: 10/26/04


Date: 26 Oct 2004 09:51:08 -0700

I want to create a standard tool bar that appears on all pages that is
a control. The toolbar has a button 'New'. What I wolud like when the
user clicks on 'New' depends on the page they are on. I would like to
do this by defining a NewFunc() that is different in each
(code-behind) page which is called by the standard 'New' button in the
toolbar.

How can I get this to work? So far I have the following (which doesnt
work). When the user clicks 'New', I would like it to call NewFunc()
as defined on the current page that is presenting the user control.

Private Sub lbtNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbtSearch.Click
        lblMessage.Text = MyClass.Page.NewFunc()
        'lblMessage.Text = MyClass.Parent.Page.NewFunc()
        'lblMessage.Text = MyBase.Page.NewFunc()

    End Sub

(in the above example, NewFunc simply returns a string to be displayed
on a label control on the toolbar)

Any suggestions appreciated.
regards
John


Quantcast