当 autopostback=true 时出现内存不足异常下拉列表
我有一个包含我的 ScriptManager 的母版页。 在子页面上我有一个更新的面板。 更新面板内有一个下拉列表。 当我设置 autopostback=true 时,我得到 OutofMemory 异常。 一直以来。 另请注意,我在 web.config 上设置了 AjaxControlToolkit。
这是我的代码的一部分。
MasterPage.aspx
<ajax:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ></ajax:ToolkitScriptManager>
子页面
<asp:UpdatePanel ID="upChTime" runat="server"><ContentTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td><asp:TextBox runat="server" ID="txChTimeClientCode" /></td>
<td><asp:DropDownList runat="server" ID="dpChTimeClient" /></td>
</tr>
因此,当我在 DropdownList 上设置 AutoPostBack=True 时,Visual Studio 内部网络服务器将达到 500MB,并且出现 OutOfMemory 异常。
评论后子页面代码隐藏
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
PopulateLatestClients()
End If
End Sub
Private Sub PopulateLatestClients()
dpChTimeClient.DataSource = GetLatestClients()
dpChTimeClient.DataTextField = "description"
dpChTimeClient.DataValueField = "id"
dpChTimeClient.DataBind()
dpChTimeClient.Items.Insert(0, "")
End Sub
I have a master page than contains my ScriptManager.
On a child page i have an updated panel.
Inside the update panel there is a dropdowlist.
When i set the autopostback=true i get OutofMemory Exceptions.
All the time.
Please also note that I have AjaxControlToolkit set on my web.config.
Here is parts of my Code.
MasterPage.aspx
<ajax:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ></ajax:ToolkitScriptManager>
Child Page
<asp:UpdatePanel ID="upChTime" runat="server"><ContentTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td><asp:TextBox runat="server" ID="txChTimeClientCode" /></td>
<td><asp:DropDownList runat="server" ID="dpChTimeClient" /></td>
</tr>
So when i set the AutoPostBack=True on the DropdownList the Visual Studio internal webserver goes to 500MB and i get a OutOfMemory Exception.
After a comment Child Page Code Behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
PopulateLatestClients()
End If
End Sub
Private Sub PopulateLatestClients()
dpChTimeClient.DataSource = GetLatestClients()
dpChTimeClient.DataTextField = "description"
dpChTimeClient.DataValueField = "id"
dpChTimeClient.DataBind()
dpChTimeClient.Items.Insert(0, "")
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GetLatestClients() 似乎返回了太多项目。你检查过了吗?
It seem that GetLatestClients() return too much items. Have you checked that?