我有一个Web应用程序,当用户在我的页面之一上进行选择时,该应用程序使用RadAjaxManager填充RadComboBox控件。这在大多数情况下都能正常工作,但是大约在AJAX调用发生时间的10%左右,但是没有值加载到目标RadComboBox中。如果关闭浏览器并再次访问该页面,则此现象似乎继续,但是几分钟后,另一个浏览器刷新,一切正常。
这是RadComboBox发起AJAX请求的Ajax设置:
<telerik:AjaxSetting AjaxControlID="rcmbMarket">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rcmbApplicationField"
LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="ApplicationFieldSource"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
这是启动和功能组合框的标记:
<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调用简单的Web服务。