Some postbacks from dynamic controls are ignored

2 posts, 0 answers
  1. Dan Lehmann
    Dan Lehmann avatar
    103 posts
    Member since:
    May 2011

    Posted 18 Jul 2011 Link to this post

    I'm using 2011_2_712 and have Uploaded a project here.

    I'm using a RadTabStrip to dynamically load various User Controls. Events on these user controls sometimes take multiple firings for them to land on the event handlers.

    To see this,
    1. Put a breakpoint on the Select statement of rgOrders_ItemCommand()
    2. Navigate to Default.aspx
    3. Press "Select" for one of the customers. (The first one, Alfreds Futterkiste has orders)
    4. Click the Orders tab.
    5. Click Select for one of the orders.
    Notice the postback is lost.

    6. Press Select again and the postback is correct.

    In my real project it takes 2 postbacks for one telerik control and 3 for another.  Can anyone make sense of this or tell me what I'm doing wrong?

    Thanks,
    Dan
  2. Dan Lehmann
    Dan Lehmann avatar
    103 posts
    Member since:
    May 2011

    Posted 18 Jul 2011 Link to this post

    Found the solution here: http://www.velocityreviews.com/forums/t71158-events-not-firing-first-time-only-in-a-dynamic-user-control-please-help.html

    Apparently ID's are required.. I fixed by adding the id like:
    Private Function GetControl(ByVal index As Int32) As UserControl
        Dim ctrl As UserControl = Nothing
        Select Case index
            Case 0
                ctrl = LoadControl("Controls/Customer.ascx")
            Case 1
                ctrl = LoadControl("Controls/Orders.ascx")
               
        End Select
         ctrl.ID = "ucID" & index
        Return ctrl
    End Function

    Thanks,
    Dan
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top