You can 'register' an event in your Page to listen for an event from your
user control by creating a delegate:
public delegate void TestPointSelectedHandler (object sender, ushort
testPointID);
and then create an event in your control that calls the delegate:
public event TestPointSelectedHandler TestPointAdded;
Then raise the event via something like:
TestPointAdded(this, ushort.Parse(strSysID));
In your page you can have something like:
Control1.TestPointAdded += new TestPointSelectedHandler(addTestPoint);
With a method that does something:
private void addTestPoint(object sender, ushort testPointID)
{
// Do some work here
}
HTH
WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Italian Pete" wrote:
> Hi,
> I have a search bar as a User Control sitting on a Page. The asp web control
> search button has its OnClick event set to a method "Search" which sets a
> bool isSearch to true.
>
> When I try to access this variable on the main page, it always comes up as
> false. I think this is due to the main Page being loaded before the Search
> method in the User Control is run.
>
> How am I able to run the Search method in the User Control before the main
> Page loads? - or is there a better way of dealing with this situation?
>
> many thanks,
>
> Pete
|