Executing an object event from another object event

see07

Regular
Joined
Apr 16, 2004
Messages
78
Location
Mexico City
Hello everybody:

Are there somebody here able to help me?

I’m using a WebUserControl embedded into a WebForm, I need when a user clicks a button placed into the WebUserControl be launched the click event of another button placed into the WebForm. How can I do this?


I attempted launch the click event from WebUserControl thus

Gestion.ConsultaIntra.Peticion.cmdButton1_Click(Gestion.ConsultaIntra.Peticion.Button1, null);


In WebForm I have:

namespace Gestion.ConsultaIntra

public class Peticion : System.Web.UI.Page

protected System.Web.UI.WebControls.Button Button1;

public void Button1_Click(object sender, System.EventArgs e)
{

}

When I compile the project send the error: CS0122 “It’s not accessible due its protection level”.

What is wrong with this?

Would you be able to help me?
I’ll appreciate your suggestions

A.L.
 
First your event should be Protected.

Why should one page handle another page's events, there is no need for this. You should create a class to handle whatever is common to both pages.
 
i think you need to do it with object oriented style:
for example:

Dim ptc as new Peticion
ptc.FormLoad 'call the function instead of event in the object
 
Back
Top