Trigger not working in updating UpdatePanel content in custom control RRS feed

  • Question

  • User-2091595391 posted


    I have a custom control which have an updatepanel in it. In this updatepanel, it only have a literal control which would be used to dynamically generate html code. The trigger control (from page) is assigned to updatepanel on Sub CreateChildControls dynamically. However when the control is fired (for my case is button click), the literal content in the updatepanel is not updated. I've tested various way (some is rather stupid) but to no avail. Hope I would be able to reach some light thru this forum. Thanks in advances. Below is the code for my custom control and page: -

    1. declare UpdatePanel and Literal control in my custom control
      Private upPnl As UpdatePanel
      Private litHTML As Literal
    2. initialize the UpdatePanel and Literal (in Sub CreateChildControls())
      upPnl = New UpdatePanel
      upPnl.ID = "upPnl"
      upPnl.UpdateMode = UpdatePanelUpdateMode.Conditional

      litHTML = New Literal
      litHTML.ID = "litHTML"
    3. assign Literal as control to UpdatePanel
    4. dynamically assign trigger to UpdatePanel (in Sub CreateChildControls())
      *Note: The trigger control ID from page is stored in Hashtable and assign in page code behind (refer to item 8)
      If Not AsyncPostBackTriggerControlID Is Nothing Then
          For Each Entry As DictionaryEntry In AsyncPostBackTriggerControlID
              Dim asynDynamic As New AsyncPostBackTrigger
              asynDynamic.ControlID = Entry.Key.ToString
      End If
    5. Add control to the custom control unit (in Sub CreateChildControls())
    6. Property in custom control to allow assignment of trigger from page
      <Bindable(True), Category("Trigger Configuration"), DefaultValue(""), Description("The collection of control ID to be added as trigger for asynchronous postback trigger."), Localizable(True)>
      Public Overridable Property AsyncPostBackTriggerControlID() As Hashtable
              Return CType(ViewState("AsyncPostBackTriggerControlID"), Hashtable)
          End Get
          Set(ByVal value As Hashtable)
              ViewState("AsyncPostBackTriggerControlID") = value
          End Set
      End Property
    7. Code in my render
      Dim upPnlID As New StringBuilder(Me.ClientID)

      writer.AddAttribute(HtmlTextWriterAttribute.Id, upPnlID.ToString)
    8. Code behind in Page (in Sub Page_Load)
      *Note: CstCtrl is the control ID for the custom control use in page
      Dim ht as New Hashtable
      ht.Add(btnTrigger.ClientID, True)
      CstCtrl.AsyncPostBackTriggerControlID = ht


    Friday, January 5, 2018 9:38 AM

All replies

  • User-707554951 posted

    Hi bjlau

    You could check the link below first:


    If you still have problem, Would you please show us with code sample so that we could reproduce your problem ?

    Best regards


    Monday, January 8, 2018 7:33 AM
  • User-2091595391 posted

    Dear Cathy,

    Thank you very much for the sharing of update panel information. I've tested but it's still not working to update the literal context text.
    As per your request, I've shared the source code of both my custom control project (Control.Modal) and asp web project (Web.Modal) in my share folder with link.


    Note: in the Web.Modal project, when button btnLaunchControlModal is click, it should change the content of the modal (which would be updated to literal in custom control). However it doesn't reflect although from debug walkthrough, the literal content text is already updated.

    Best Regards,

    Monday, January 8, 2018 11:54 PM
  • User-2091595391 posted

    I've been cracking my head but still not able to get it work.
    Is anyone out there able to share some tips on how to get about with this issue?

    I've included the source code in google drive for what i've done so far.
    Appreciate a lot for helps

    Thank you

    Sunday, January 14, 2018 5:52 AM