Trigger one UserControl event from another UserControl event

Last Reply on Feb 14, 2013 03:51 AM By Mudassar

Posted on Feb 14, 2013 03:36 AM

Hi

I have page having two user controls. Now I have a requirement for which i have to trigger one user control event from another user control.

If this is possible then please guide me in this regard

Regards

TanzeelurRehman

Posted on Feb 14, 2013 03:51 AM

It is very easy. Suppose you have 2 Usercontrols and you need to call method of UserControl1 in UserControl2. So you can do as following

Method in UserControl1

  public void ShowMessage()
    {
        //Do something here
    }

Calling in UserControl2

 UserControl1.ShowMessage();