Dynamically loading User Controls

Discussion in 'ASP .Net' started by Christian Resma Helle, Aug 6, 2008.

  1. Hey guys,

    I'm working on an AJAX Enabled ASP.NET Web application. I have a TreeView
    web control and an PlaceHolder web control. My PlaceHolder is inside an
    UpdatePanel and AsyncPostBacks are triggered by the SelectedNodeChanged
    event of the TreeView. I dynamically load user controls into my PlaceHolder
    depending on what node the user clicks on the TreeView. The user control is
    loaded into the page and is displayed to the user.

    These user controls would normally have a buttons for save, update, and
    delete operations. My problem is that "SOMETIMES" when I click on a button
    in my dynamically loaded user control, the user control is just reloaded and
    the button click event is not fired. This problem does not occur every time
    though, which makes it very annoying!

    Any ideas on how to ensure that buttons within my dynamically loaded user
    controls fire click events everytime its clicked?

    --
    Regards,
    Christian
    Christian Resma Helle, Aug 6, 2008
    #1
    1. Advertising

  2. Found the problem! I did not set the ID of the UserControl I wanted to load
    dynamically.

    --
    Regards,
    Christian

    "Christian Resma Helle" <christian [dot] helle [at] yahoo [dot] com> wrote
    in message news:...
    > Hey guys,
    >
    > I'm working on an AJAX Enabled ASP.NET Web application. I have a TreeView
    > web control and an PlaceHolder web control. My PlaceHolder is inside an
    > UpdatePanel and AsyncPostBacks are triggered by the SelectedNodeChanged
    > event of the TreeView. I dynamically load user controls into my
    > PlaceHolder depending on what node the user clicks on the TreeView. The
    > user control is loaded into the page and is displayed to the user.
    >
    > These user controls would normally have a buttons for save, update, and
    > delete operations. My problem is that "SOMETIMES" when I click on a button
    > in my dynamically loaded user control, the user control is just reloaded
    > and the button click event is not fired. This problem does not occur every
    > time though, which makes it very annoying!
    >
    > Any ideas on how to ensure that buttons within my dynamically loaded user
    > controls fire click events everytime its clicked?
    >
    > --
    > Regards,
    > Christian
    >
    >
    Christian Resma Helle, Aug 7, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]
    Replies:
    0
    Views:
    596
    Ben Miller [msft]
    Aug 5, 2003
  2. sonic_soul
    Replies:
    0
    Views:
    517
    sonic_soul
    Aug 14, 2003
  3. Nick Stansbury

    loading user controls dynamically

    Nick Stansbury, Jul 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    338
    John Saunders
    Jul 19, 2004
  4. =?Utf-8?B?V291dGVy?=

    Dynamically Loaded controls loading other controls

    =?Utf-8?B?V291dGVy?=, Feb 27, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    494
    =?Utf-8?B?V291dGVy?=
    Feb 27, 2006
  5. Bob Rock
    Replies:
    1
    Views:
    624
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
Loading...

Share This Page