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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. User Control's Button Click event is not firing

User Control's Button Click event is not firing

Scheduled Pinned Locked Moved ASP.NET
helpwinformstutorial
4 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.
  • S Offline
    S Offline
    sri_con3
    wrote on last edited by
    #1

    Hi, I am adding one user control(Login.ascx) to my web form’s Placeholder Control in a button click event of the (Home.aspx) page. When ever i am clicking on the webform button i can able to add the user control to the Placeholder. but the problem is when ever i am trying to click on the User Controls Button its disappearing from the form. Even though I checked the view state also. When i am loading the User Control to the Placeholder it is firing the PageLoade Event of the User Control (Login.ascx).I want the User Control has to be appear in then form and also the ButtonClick event of the User Controls is to fire, so how to make this work. if any one have the solution for it please help me Code: Login.ascx Button2_Click { Response.Wrie("Test"); } Home.aspx Button1_Click { UserControl MyControl = (UserControl) LoadeControl("Login.ascx"); //User Control(Login.ascx) is residing in the same folder PlaceHolder1.Control.Add(MyControl); // Its firing the Page Loade event of the User Control (Login.ascx) }

    sri

    E 1 Reply Last reply
    0
    • S sri_con3

      Hi, I am adding one user control(Login.ascx) to my web form’s Placeholder Control in a button click event of the (Home.aspx) page. When ever i am clicking on the webform button i can able to add the user control to the Placeholder. but the problem is when ever i am trying to click on the User Controls Button its disappearing from the form. Even though I checked the view state also. When i am loading the User Control to the Placeholder it is firing the PageLoade Event of the User Control (Login.ascx).I want the User Control has to be appear in then form and also the ButtonClick event of the User Controls is to fire, so how to make this work. if any one have the solution for it please help me Code: Login.ascx Button2_Click { Response.Wrie("Test"); } Home.aspx Button1_Click { UserControl MyControl = (UserControl) LoadeControl("Login.ascx"); //User Control(Login.ascx) is residing in the same folder PlaceHolder1.Control.Add(MyControl); // Its firing the Page Loade event of the User Control (Login.ascx) }

      sri

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      So, you are adding the UC dynamically?

      S 1 Reply Last reply
      0
      • E ednrgc

        So, you are adding the UC dynamically?

        S Offline
        S Offline
        sri_con3
        wrote on last edited by
        #3

        Yes i am adding UC at run time

        sri

        E 1 Reply Last reply
        0
        • S sri_con3

          Yes i am adding UC at run time

          sri

          E Offline
          E Offline
          ednrgc
          wrote on last edited by
          #4

          Then you have to rewire the events on every postback.

          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