?
Solved

WebUserControl event not firing.  Is PlaceHolder the problem?  Or the dynamic adding?

Posted on 2007-11-20
2
Medium Priority
?
928 Views
Last Modified: 2008-02-01
I am signing-up for the event, but it is not firing at runtime....

Is the placeholder interfering, or is it the fact that I have to create and add the control dynamicall?

I added the web user control to a new WebForm and the event fires just fine, so the control is capable of raising the event, and web pages can consume it, but for some reason it is not working in my placeholder control.


private void CreateMessageBox(string custommessage, bool YesVisible, bool NoVisible, bool CancelVisible, bool OkVisible, int tempCurrentIndex, bool msgboxvisible)
    {
        Control stepmonitor = LoadControl("..\\scripts\\controls\\FUWStepMonitor\\FUWStepMonitor.ascx");
        members_beta_scripts_controls_FUWStepMonitor_FUWStepMonitor fuwsm = (members_beta_scripts_controls_FUWStepMonitor_FUWStepMonitor)LoadControl("..\\scripts\\controls\\FUWStepMonitor\\FUWStepMonitor.ascx");
        fuwsm.currentIndex = tempCurrentIndex;
        fuwsm.SetVisibleButtons(YesVisible, NoVisible, CancelVisible, OkVisible);
        fuwsm.SetCustomMessage = custommessage;

        fuwsm.YesButtonClicked += null;
        fuwsm.YesButtonClicked += new EventHandler(this.HandleMessageBoxYesButtonClicked);

        fuwsm.NoButtonClicked += null;
        fuwsm.NoButtonClicked += new EventHandler(this.HandleMessageBoxNoButtonClicked);

        fuwsm.CancelButtonClicked += null;
        fuwsm.CancelButtonClicked += new EventHandler(this.HandleMessageBoxCancelButtonClicked);

        fuwsm.OkButtonClicked += null;
        fuwsm.OkButtonClicked += new EventHandler(this.HandleMessageBoxOkButtonClicked);

//ADD CONTROL TO PLACEHOLDER
        msgbox.Controls.Add((Control)fuwsm);
        msgboxdiv.Style.Add(HtmlTextWriterStyle.Position, "absolute; left:30px; top:200px;");

        msgboxdiv.Visible = msgboxvisible;

    }
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 2000 total points
ID: 20327803
You have to recreate dynamically created controls on a postback if you want the events to fire.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 20328474
I found out that you are correct.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question