Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ButtonClick eventhandler for dynamically loaded UserControl fails to catch event.

ButtonClick eventhandler for dynamically loaded UserControl fails to catch event.

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomtutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larantz
    wrote on last edited by
    #1

    Hi everyone. I've been handed a Web application that dynamically loads custom UserControls. Upon a useraction, clicking a link to a given "page" (UserControl), I instanciate the control using the Page.LoadControl method, store it to Session["Control"], and add it to PlaceHolder.Controls. This seemed to work out perfectly as the control was maintained on the postback and the state was also maintained. But after I started implementing a button eventhandler I noticed that the event is never caught when the button is clicked and the control refreshes. I'm not that familiar with Asp.Net as I usually work with windows applications and services. Could anyone please point me in the right direction of how to avoid loosing the event in the postback? Best regards! -Larantz-

    for those about to code, we salute you
    http://www.itverket.no

    Please refer to the Forum Guidelines for appropriate posting.

    L 1 Reply Last reply
    0
    • L Larantz

      Hi everyone. I've been handed a Web application that dynamically loads custom UserControls. Upon a useraction, clicking a link to a given "page" (UserControl), I instanciate the control using the Page.LoadControl method, store it to Session["Control"], and add it to PlaceHolder.Controls. This seemed to work out perfectly as the control was maintained on the postback and the state was also maintained. But after I started implementing a button eventhandler I noticed that the event is never caught when the button is clicked and the control refreshes. I'm not that familiar with Asp.Net as I usually work with windows applications and services. Could anyone please point me in the right direction of how to avoid loosing the event in the postback? Best regards! -Larantz-

      for those about to code, we salute you
      http://www.itverket.no

      Please refer to the Forum Guidelines for appropriate posting.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hey First things first - check that the event is wired up correctly - think off the top of my head this is done in oninit or some other initialisation function within the page: http://msdn2.microsoft.com/en-us/library/ms743596.aspx If this doesnt fix it then make sure that ISS is using the correct version of .NET. If this doesnt work then google asp.net event not firing as there is loads of help (I had this problem too) - i cant remember how i changed the version of .NET but it is in the properties. Hope this helps Dan

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups