“User Control” uses an incorrect event

Posted by Lijo on Stack Overflow See other posts from Stack Overflow or by Lijo
Published on 2010-05-10T17:41:26Z Indexed on 2010/05/10 17:44 UTC
Read the original article Hit count: 146

Filed under:

Hi,

I am using two instances of a user control. But when I click on a button in the user control, both of the instances calls the function corresponding to the first event (AcknowledgeReceipt()) However, when I remove the first user control and clicks on the btnRequestClarification, it calls the correct method (RequestClarification())

Is there a way to correct this behavior?

acknowledgeModificationPopupCtrl = (ConfirmationPopup)this.LoadControl("~/ConfirmationPopup.ascx");
            plHConfirmationPopup.Controls.Add(acknowledgeModificationPopupCtrl);
            acknowledgeModificationPopupCtrl.ContinueClick += new EventHandler(AcknowledgeReceipt);
            RequiredFieldValidator reqFValidatorAcknowledge = (RequiredFieldValidator)acknowledgeModificationPopupCtrl.FindControl("reqValidatorTxt");
            reqFValidatorAcknowledge.ValidationGroup = "AcknowledgeReceipt";
            acknowledgeModificationPopupCtrl.ValidationGroup = "AcknowledgeReceipt";
            btnAcknowledgeReceipt.Attributes.Add("onclick", "validateconfirmPopup('true','xx' ,’yyy','Note' ,'true'); return false;");



            requestModificationPopupCtrl = (ConfirmationPopup)this.LoadControl("~/ConfirmationPopup.ascx");
            plHConfirmationPopup.Controls.Add(requestModificationPopupCtrl);
            requestModificationPopupCtrl.ContinueClick += new EventHandler(RequestClarification);
            RequiredFieldValidator reqFValidator = (RequiredFieldValidator)requestModificationPopupCtrl.FindControl("reqValidatorTxt");
            reqFValidator.ValidationGroup = "request";
            requestModificationPopupCtrl.ValidationGroup = "request";
            btnRequestClarification.Attributes.Add("onclick", "validateconfirmPopup('true',’kkk' ,’lll','ff' ,'true'); return false;");

Thanks

Lijo

© Stack Overflow or respective owner

Related posts about ASP.NET