微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

.net – RadAjaxManager AJAX请求大约有10%的时间失败

我有一个Web应用程序,当用户在我的一个页面上进行选择时,它使用RadAjaxManager来填充RadComboBox控件.这大部分时间都可以正常工作,但是大约有10%的时间 AJAX调用似乎触发但没有值加载到目标RadComboBox中.如果浏览器关闭并再次访问该页面,则此行为似乎仍在继续,但几分钟后,另一个浏览器刷新一切正常.

以下是启动AJAX请求的RadComboBox的Ajax设置:

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

这是启动和traget组合框的标记

<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>

以下是市场组合框的选定索引更改时调用的Market_Check子代码背后的代码

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

这一切都非常简单,所以我真的不确定为什么我的这个问题正在发生.任何帮助都将不胜感激.

尝试使用Telerik Ajax更新ApplicationFieldSource.

无论如何这种方法非常棘手,今天你有这么多的客户端服务器例如,技术远远优于RadAjaxManager / MS ASP.NET ajax简单的jQuery调用简单的webservice.

原文地址:https://www.jb51.cc/ajax/160001.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐