I would like to call my Public String Function(...) method from my .ascx‘s Page_Load event. The function and containing class are located in the same code behind as the web control. But I am unable to access the function. How can I resolve this problem?
Example:
public class Controls_WebApp : System.Web.UI.UserControl, IAttributeAccessor, IUserControlDesignerAccessor
{
protected void Page_Load(object sender, EventArgs e)
{
// Call Function
}
}
public class A
{
public string Function(string path)
{
}
}
As it stands you will need an instance of
Ato invoke the methodAlternatively if the function has no reliance on the state of A, you can make the function static (
public static string Function)