I have an ASPX page that calls a user control (ASCX) to render a form. The control includes code-behind that fires when a certain button is clicked, like this:
Protected Sub ClickControlButton(ByVal sender as Object, ByVal e as System.EventArgs)
' run some code
' need to put something here, which I'll explain below
Response.Redirect(Request.RawUrl)
End Sub
(For example purposes, let's say this control is called ChildControl.ascx. Note: the Response.Redirect call ends up going back to the parent page, so when it fires, it effectively reloads the page.) ChildControl.ascx is embedded within another form that I'll call ParentPage.aspx.
I need this sub to call another sub in the parent page (let's call it ParentPage.aspx) code-behind an instance inherited by ParentPage.aspx (see my edit explanation below), something like this:
Protected Sub SomeFunction()
'run some more code
End Sub
I need this called before the redirect happens. So, effectively, when all is said and done, I need my control code to look something like this:
Protected Sub ClickControlButton(ByVal sender as Object, ByVal e as System.EventArgs)
' run some code
SomeFunction()
Response.Redirect(Request.RawUrl)
End Sub
However, the control does not recognize SomeFunction(), probably because it is a Protected Sub, not Public, (EDIT) and it is an instance class. I'm trying to avoid changing it to a Public Sub.
How would I go about handling this?
Thanks in advance . . .
EDIT: A colleague, who knows more about this system than I do, pointed out that the method I'm trying to access is not in the ParentPage.aspx, as I'd mentioned earlier, but is actually an instance method stored within a separate VB file (it is, however, accessible via Inherit from ParentPage.aspx -- apologies for the confusion in my original question). So reflection would not work, in this case.