G
George Leithead
Hi,
I have the following in an ASPX page, that is an event listener, that
works fine.
BasicSearch1.SearchActivated += new
myWebControlLibrary.BasicSearch.SearchEventHandler(SearchResults1.PerformSearch);
However, I would like to change the ASPX page to not assume the name of
the control, but instead listen to the event programmatically. I tried
the below, which does compile and resolve correctly, however, it does
not appear to be 'listening' to the event and does not get triggered!
foreach (Control ctrl in Page.Controls)
{
if (ctrl.GetType() ==
typeof(myWebControlLibrary.BasicSearch))
{
// This SHOULD have worked! But it doesnt appear to
indicate that it is listening!
((myWebControlLibrary.BasicSearch)ctrl).SearchActivated += new
WebControlLibrary.BasicSearch.SearchEventHandler(SearchResults1.PerformSearch);
}
}
I have the following in an ASPX page, that is an event listener, that
works fine.
BasicSearch1.SearchActivated += new
myWebControlLibrary.BasicSearch.SearchEventHandler(SearchResults1.PerformSearch);
However, I would like to change the ASPX page to not assume the name of
the control, but instead listen to the event programmatically. I tried
the below, which does compile and resolve correctly, however, it does
not appear to be 'listening' to the event and does not get triggered!
foreach (Control ctrl in Page.Controls)
{
if (ctrl.GetType() ==
typeof(myWebControlLibrary.BasicSearch))
{
// This SHOULD have worked! But it doesnt appear to
indicate that it is listening!
((myWebControlLibrary.BasicSearch)ctrl).SearchActivated += new
WebControlLibrary.BasicSearch.SearchEventHandler(SearchResults1.PerformSearch);
}
}