AJAX call fails ~ 10% of the time

2 posts, 0 answers
  1. Derek Bressler
    Derek Bressler avatar
    1 posts
    Member since:
    Apr 2010

    Posted 13 Nov 2012 Link to this post

    Hello,

    I have an application which uses RadAjaxManager to populate RadComboBoxes as users make selections on the page.  This works correctly most of the time however roughly 10% of the time the user will make a selection from combo box 1 which is supposed to populate combo box 2, the Ajax request seems to fire but it loads no values in combo box 2.

    I have tested and the error is definitely not related to the data.  I can test using the exact same data that was used by someone who encountered the error and combo box 2 will load correctly for me.

    Here are the Ajax settings for Combo Box 1:

    <telerik:AjaxSetting AjaxControlID="rcmbMarket">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rcmbApplicationField" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="ApplicationFieldSource" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>

    Here is the markup for combo boxes 1 & 2:

    <asp:TableRow HorizontalAlign="Center" ID="ProductRow3">
            <asp:TableCell Width="25%" HorizontalAlign="Left" ID="MarketLabelCell">
                <asp:Label ID="lblMarket" runat="server" Text="Market: "></asp:Label>
                <asp:RequiredFieldValidator ID="vldMarket" runat="server" ControlToValidate="rcmbMarket" 
                    ErrorMessage="*" ForeColor="Red" SetFocusOnError="true" ValidationGroup="grpMain"></asp:RequiredFieldValidator>
            </asp:TableCell>
            <asp:TableCell Width="25%" HorizontalAlign="Left" ID="MarketDDLCell">
                <telerik:RadComboBox ID="rcmbMarket" runat="server" AllowCustomText="false" DataSourceID="MarketSource" AutoPostBack="true" CausesValidation="false"
                    DataTextField="MarketDesc" DataValueField="pkMarketID" AppendDataBoundItems="true" OnSelectedIndexChanged="Market_Check">
                    <Items>
                        <telerik:RadComboBoxItem Text="" Value="" />
                    </Items>
                </telerik:RadComboBox>
                <asp:SqlDataSource ID="MarketSource" runat="server" ConnectionString="<%$ ConnectionStrings:QuoteProdConn %>" SelectCommand="SELECT pkMarketID, MarketDesc FROM Data.Market WHERE Active = 'True' ORDER BY MarketDesc ASC"></asp:SqlDataSource>
            </asp:TableCell>
            <asp:TableCell Width="25%" HorizontalAlign="Left" ID="ApplicationLabelCell">
                <asp:Label ID="lblApplicationField" runat="server" Text="Application Field:"></asp:Label>
                <asp:RequiredFieldValidator ID="vldAppField" runat="server" ControlToValidate="rcmbApplicationField" 
                    ErrorMessage="*" ForeColor="Red" SetFocusOnError="true" ValidationGroup="grpMain"></asp:RequiredFieldValidator>
            </asp:TableCell>
            <asp:TableCell Width="25%" HorizontalAlign="Left" ID="ApplicationTextCell">
                <telerik:RadComboBox ID="rcmbApplicationField" runat="server" AllowCustomText="false" DataSourceID="ApplicationFieldSource" ExpandDirection="Down"
                    AutoPostBack="true" DataTextField="AppDescription" DataValueField="pkAppFieldID" AppendDataBoundItems="true" CausesValidation="false" MaxHeight="300px">
                    <Items>
                        <telerik:RadComboBoxItem Text="" Value="" />
                    </Items>    
                </telerik:RadComboBox>
                <asp:SqlDataSource ID="ApplicationFieldSource" runat="server" ConnectionString="<%$ ConnectionStrings:QuoteProdConn %>"></asp:SqlDataSource>
            </asp:TableCell>
        </asp:TableRow>

    Here is the associated code behind function:

    Protected Sub Market_Check(ByVal sender As Object, ByVal e As System.EventArgs)
      
            Dim tmpItem As New Telerik.Web.UI.RadComboBoxItem("", "")
            ApplicationFieldSource.SelectCommand = "SELECT pkAppFieldID, AppDescription FROM Data.ApplicationField WHERE Active = 'True' AND fkMarketID = " & rcmbMarket.SelectedValue.ToString() & " ORDER BY AppDescription ASC "
            ApplicationFieldSource.DataBind()
            rcmbApplicationField.Items.Clear()
            rcmbApplicationField.Items.Add(tmpItem)
            rcmbApplicationField.DataBind()
      
        End Sub

    Everything here seems fairly simple so I am having a really hard time understanding why my users are encountering this issue.  The fact that it is so hard to replicate has also made this extremely difficult to troubleshoot.  Any help at all would be appreciated.

    Thank you!

    EDIT:  Some further information... When the issue happens it seems to persist for a few minutes.  All AJAX calls seem to fail but no error is displayed and nothing is reported to the event logs on the web server.  After a few minutes and a browser restart everything works fine once again.
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 16 Nov 2012 Link to this post

    Hello Derek,


    As the issue you described is rather strange and as you said it would be rather difficult to troubleshoot the issue without having the chance to reproduce it locally.
    Could you please disable the ajax on the page and verify if the problem still appears? Also could you try to wrap the "rcmbMarket", "rcmbApplicationField" and the "ApplicationFieldSource" controls into single RadAjaxPanel or asp UpdatePanel and verify how it goes?
    Also please ensure that no subsequent request appear before the initial ajax request finishes in the problematic moments. This may cause request termination and could bubble the presented issue.


    Regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top