Solved

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

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

Technology Partners: 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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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