Is it possible to kill all events for a control?
-
I have a page with a bunch og events for buttons and textchanged. At page load I want to validate an object I have added to Chash, an if it fails I want to kill the event that the user has triggerd, something like
protected void Page_Load(object sender, EventArgs e)
{
if (MyChachItem == null)
{
// Kill the event so it is not triggerd
MyAntemPlaceHolder.Visible = true;
ShowMessage(MyAntemPlaceHolder, "Can not continue, please click on the list button and start over.")
}
}So the user clicks a button (btnSave) on the page, that triggers the btnSave_Click(..) event. Thus, by the time the MyChachItem is null, as validate at Page_Load, and within that if() I want to kill the btnSave_Click(..) event, so it isn't triggerd. I think it's possible to use somthing like:
btnSave.Click -= btnSave_Click(..)
But my problem is that the MyHugeWebControl.ascx contains a lot of controlers with different events, and I was wondering if there where something I could do to kill all the events within that control. Thanks Thomas