I have a onclick event that is like:
public void OnMyButton_Click(object sender, EventArgs e)
How can I call this from within pageload?
this function is what you need:
public static void DoClick(this System.Web.UI.WebControls.Button btn)
{
System.Reflection.MethodInfo m = typeof(System.Web.UI.WebControls.Button)
.GetMethod("OnClick", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
m.Invoke(btn, new object[] { EventArgs.Empty });
}