Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET-将viewstate持久化到文件会导致ASP更新面板控件出现问题_C#_Asp.net_Ajax_Updatepanel_Viewstate - Fatal编程技术网

C# ASP.NET-将viewstate持久化到文件会导致ASP更新面板控件出现问题

C# ASP.NET-将viewstate持久化到文件会导致ASP更新面板控件出现问题,c#,asp.net,ajax,updatepanel,viewstate,C#,Asp.net,Ajax,Updatepanel,Viewstate,我的ASP.NET项目中的下拉列表控件有问题,这让我很恼火!感谢所有的帮助 在我的页面的更新面板上有两个DropDownList,DropDownList 1用作DropDownList 2的过滤器,它反过来填充一个列表框。问题在于,当覆盖以下页面viewstate持久性方法时,会发生以下行为: 1在DropDownList1中选择一个值,DropDownList2将相应地填充。 2在DropDownList2中选择一个值,列表框不加载任何内容,DropDownList2将丢失其所选值 这些事件

我的ASP.NET项目中的下拉列表控件有问题,这让我很恼火!感谢所有的帮助

在我的页面的更新面板上有两个DropDownList,DropDownList 1用作DropDownList 2的过滤器,它反过来填充一个列表框。问题在于,当覆盖以下页面viewstate持久性方法时,会发生以下行为:

1在DropDownList1中选择一个值,DropDownList2将相应地填充。 2在DropDownList2中选择一个值,列表框不加载任何内容,DropDownList2将丢失其所选值

这些事件的代码背后的逻辑似乎没有问题,因为当我从页面中删除Updatepanel时,它工作正常!最简单的是,当updatepanel存在但viewstate未被覆盖时,它会起作用

我在Visual Studio中进行了一些跟踪,似乎第二次回发时调用了DropDownList1的事件,尽管只应调用DropDownList2的事件,所以我想知道ASP是否持有某种类型的事件堆栈,它正在调用第一个事件,即使它已经被调用并且应该被清除。它适用于不存在UpdatePanel的页面

我已经越过了障碍

Page.SavePageStateToPersistenceMedium 

要根据本例从文本文件保存/加载,请执行以下操作:

已在每个控件上设置以下属性:

<asp:UpdatePanel runat="server" ID="upMain" UpdateMode="Conditional" >

<asp:DropDownList ID="DropDownList1" runat="server" CssClass="TextBoxFull" AutoPostBack="True"  OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" ondatabound="DropDownList1_DataBound">

<asp:DropDownList ID="DropDownList2" runat="server" CssClass="TextBoxFull" AutoPostBack="True"  OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged" ondatabound="DropDownList2_DataBound">
感谢任何帮助,这一整天都让我发疯


谢谢。

最后我想不出这一点,所以我重新编写了从PageStatePersister类继承的整个内容,它工作得很好。有时候最好从头开始。

真的没有人解决这个问题吗?我也快疯了
<asp:UpdatePanel runat="server" ID="upMain" UpdateMode="Conditional" >

<asp:DropDownList ID="DropDownList1" runat="server" CssClass="TextBoxFull" AutoPostBack="True"  OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" ondatabound="DropDownList1_DataBound">

<asp:DropDownList ID="DropDownList2" runat="server" CssClass="TextBoxFull" AutoPostBack="True"  OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged" ondatabound="DropDownList2_DataBound">