Pronunciation / adjective
Bringing something good and unforseen.
    Skip Navigation Links > Code Repository
   

Dynamically added user control's button click event doesn't fire until second time clicked?



 
Return

Dynamically added user control's button click event doesn't fire until second time clicked?

When a user control is added to a page dynamically it is important to specify it's ID in the control's page load. Otherwise events that fire client side may not fire properly.

  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. 'Put user code to initialize the page here
  3. Me.ID = "MyControl1"
  4. End Sub


Return
Microsoft Certified Professional   © 2018 Fortunate.  All rights reserved.
contact: justin@aboutfortunate.com