Possible glitch with RadAjaxPanel

3 posts, 0 answers
  1. William
    William avatar
    16 posts
    Member since:
    Jul 2010

    Posted 10 Aug 2010 Link to this post

    It seems that if you have your form submit button inside a RadAjaxPanel and you exit the sub where you are handling the button click, it will not focus or show labels outside of the RadAjaxPanel

    Here is the code on the page:
    <telerik:RadAjaxPanel ID="RadAjaxPanelx" LoadingPanelID="RadAjaxLoadingPanelx" runat="server">
                 <asp:Button ID="btnSubmit" runat="server" CausesValidation="true" OnClick="btnSubmit_Click" Text="Submit" /><br />
                </telerik:RadAjaxPanel>
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanelx" Height="300" Width="500" runat="server" Skin="Sunset">
                </telerik:RadAjaxLoadingPanel>

    Here is the code behind where I am validating that at least one of seven checkboxes is selected in a checkbox list named chklPayment :

    Public Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs)
            ' Check to see at least one checkbox checked.
            Dim CheckedBox As Boolean = False
            For Each CheckedItem As ListItem In chklPayment.Items
                If CheckedItem.Selected = True Then
                    CheckedBox = True
                End If
            Next
            If CheckedBox = False Then
               lblError.Visible = True

              
    chklPayment.Focus()
                Exit Sub
            Else
                lblError.Visible = False
            End If
     
        End Sub

    Now if the label is INSIDE the RadAjaxPanel - say right below the submit button, it will toggle label visibility as the code requires BUT if the label is contained OUTSIDE the RadAjaxPanel, it will not toggle at all. I've spent about three hours on this with varying testing scenarios and this behavior is definitely happening. I have the submit button inside the RadAjaxPanel because I am using a Loading Panel with it as the form takes awhile sometimes to complete the postback.

    No biggie as I can put the label inside the RadAjaxPanel and it works fine. I can also use the label to say something like "Please wait while your information is updated" or something like that if validation passes for the checkbox list. Sorry if this is already noted somewhere in the documentation - I couldn't find it.
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 10 Aug 2010 Link to this post

    Hello William,

    That behaviour is not a glitch, any control contained in the RadAjaxPanel can only update the controls contained in the RadAjaxPanel. That is how it works. If you want to place them anywhere on the page and not have to contain all the controls you want updated in the same RadAjaxPanel when a control makes a post back, you should use RadAjaxManager, which should help you get the job done.

    I hope that helps.
  3. William
    William avatar
    16 posts
    Member since:
    Jul 2010

    Posted 11 Aug 2010 Link to this post

    Well, I appreciate the answer but I wasn't aware that the submit button was updating anything - it does trigger the subroutine to fire when clicked but that doesn't seem like it is really updating controls. I mean, the subroutine does the updating, not the control (submit button) itself.

    Regardless, it works the way you describe so I have awareness now... (and once you become aware, you cannot become unaware.....).

    Thanks again for the reply.
Back to Top