I am attempting to manage an ajax connection by calling a button onclick method on a separate web part in order to force the partial postback on the consumer.
Web part A (Provider) invokes the method on Web Part B (Consumer)
Web Part A
Type t = myButton.GetType(); object[] p = new object[1]; p[0] = EventArgs.Empty; MethodInfo m = t.GetMethod("OnClick", BindingFlags.NonPublic | BindingFlags.Instance); m.Invoke(myButton, p);
Web Part B
public void btnHidden_Click(object sender, EventArgs e) { Label1.Text = "Hidden Button: " + DateTime.Now.ToString(); }
When I use reflection, I get the correct information on the HiddenButton. However, I cannot invoke the "OnClick" event. The btnHidden_Click does not execute. It works fine when I invoke from WebPart B to WebPart B, but not from a different webpart.
There doesn't appear to be too much information regarding this behavior. Any suggestions?
Thanks.
Rob