我开发了一个应用程序,其中使用了 UpdatePanel、Repeater 和 ObjectDataSource。
问题是当我使用这三个时,我收到类似 “Sys.WebForms.PageRequestManagerServerErrorException:调用目标引发异常”的错误。
问题仅在 IE8 中出现,而不在本地发生我的意思是我在 IE8 中的本地机器工作正常,但是当我在 IIS 上托管应用程序时,IE8 创建了一个问题,所有浏览器一切正常。
下面提到的代码
<asp:HiddenField runat="server" ID="hdnKey" Value="mainAlt" />
<qfx:label runat="server" ID="Label1" CssClass="subHeading" Text="term_Shares"></qfx:label>
<asp:Repeater ID="rptShareTypeList" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<div class="shareItem">
<span class="shareItemButton"></span>
<span class="shareItemLabel">
<%#IRAppMgr.Translate(Convert.ToString(Eval("title"))) %>
<input style="display: none" class="ShareTypeCheckBox" type="checkbox" name='<%# Eval("key") %>' value="<%#Eval("Code") %>" <%# Eval("checked12") %> />
<input class="ShareColor" type="hidden" value="<%#Eval("Color") %>" />
<input class="ShareCurrency" type="hidden" value="<%#Eval("Currency") %>" />
</span>
</div>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="SharesTypeDS" runat="server" DataObjectTypeName="Qfx.DataClasses.Config.Option"
SelectMethod="SelectShareType" TypeName="Qfx.Bases.data.DataManager">
<SelectParameters>
<asp:ControlParameter ControlID="ClientMarker" Name="appConfig" PropertyName="Config"
Type="Object" />
<asp:ControlParameter ControlID="ClientMarker" Name="client" PropertyName="Client" />
<asp:Parameter Name="selection" DefaultValue="ShareType" />
</SelectParameters>
</asp:ObjectDataSource>
我的 InstrumentSelectionBox.ascx 控件中的上述代码
在我的 Qfx.Bases.data.DataManager 类中
public List<Option> SelectShareType(object appConfig, string client, string selection, string ShareKey)
{
AppConfig config = (AppConfig)appConfig;
List<Option> Options = null;
if (config.getSelectionByKey(ShareKey + selection) != null)
Options = config.getSelectionByKey(ShareKey + selection).Options;
if (Options != null && Options.Count > 0)
{
foreach (Option option in Options)
{
if (option.Currency == null && IRAppManager.Manager != null)
{
DataClasses.Share.Instrument inst = IRAppManager.Manager.GetInstrument(option.Key);
option.Currency = (inst != null) ? IRAppManager.Manager.Translate(inst.Currency) : "";
}
if (option.VolumeDivisor == null || option.VolumeDivisor.Trim() == string.Empty)
option.VolumeDivisor = option.VolumeValue;
option.Code = (config.GetDataSourceByKey(option.Key) != null) ? config.GetDataSourceByKey(option.Key).Code : "";
if (option.Code != string.Empty)
{
option.TimeStamp = GetTimeStampDetail(option.Code);
}
}
}
return (config.getSelectionByKey(ShareKey + selection) != null) ? config.getSelectionByKey(ShareKey + selection).Options : new List<Option>();
}
我在更新面板中使用过
<asp:UpdatePanel ID="upTab" runat="server">
<ContentTemplate>
<uc:InstrumentSelectionBoxrunat="server" ID="UTCInstrumentSelectionBox"></uc:InstrumentSelectionBoxrunat>
</ContentTemplate>
</asp:UpdatePanel>
在浏览器控制台中进行一些调试后,我认为由于 ObjectDataSource 发生了错误,所以我删除了 ObjectDataSource 并将转发器正常与 Id 绑定,然后它在 IE8 中工作正常。
所以任何人都可以帮助我在使用 ObjectDataSource 时在 IE8 中是否有任何限制,或者我的代码有错误。你的回应应该得到高度评价。谢谢