8

I have a web application which uses a RadAjaxManager to populate RadComboBox controls as a user makes selections on one of my pages. This works correctly most of the time however roughly 10% of the time the AJAX call seems to fire but no values are loaded into the target RadComboBox. If the browser is closed and the page accessed again this behavior seems to continue but after a few minutes and another browser refresh everything works fine once again.

Here are the Ajax settings for the RadComboBox initiating the AJAX request:

<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 the initiating and traget combo boxes:

<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 code behind for the Market_Check sub called when the selected index of the market combo box is changed:

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

It is all pretty simple so I am really not sure why my this issue is happening. Any help at all would be appreciated.

4

2 回答 2

0

也尝试使用 Telerik Ajax 更新 ApplicationFieldSource。

无论如何,这种方法非常棘手,今天您拥有比 RadAjaxManager/MS ASP.NET ajax 好得多的客户端服务器技术,例如对简单 Web 服务的简单 jQuery 调用。

于 2013-03-07T09:49:44.927 回答
0

您是否尝试使用 FireBug(Net 选项卡)或 Fiddler 检查请求和响应属性?如果 rcmbMarket 项目的某些选定值(即数据库中的一些不良数据)发生这种情况,这可以提供更多的洞察力。另外,请检查页面是否太重而无法发布。RadAjaxManager 即使在 ajax 请求中也会发布整页。

于 2013-07-03T08:52:41.823 回答