Solved

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

Posted on 2007-11-20
2
922 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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