我看到了错误:
The state information is invalid for this page and might be corrupted
在我的页面上。根据一些阅读,我推测错误可能是由几个原因造成的,a并且很难排除故障。
在aspx页面上,我有两个下拉控件:
<asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="dsClients" DataTextField="Client_Name" DataValueField="Client_Name" AutoPostBack="True" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged" ondatabound="DropDownList3_DataBound"></asp:DropDownList>
<asp:DropDownList ID="ddQualIDInsert" runat="server" DataSourceID="dsQual" DataTextField="Project_Name" DataValueField="Qual_ID"></asp:DropDownList>
在代码隐藏文件中,我使用ajax根据从第一个下拉菜单中选择的值来更新和重新构建第二个下拉选项:
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
dsQual.Where = "Client_Name = \"" + ((DropDownList)sender).SelectedValue +"\"";
}
下拉get有时是按填充的,但是大多数情况下都会抛出错误。
发布于 2013-04-11 21:35:22
您正在动态更改您的页面(服务器端控件),这将更改页面的view state
,因此在回发时,ASP.NET将解密view state
,但这与预期的不匹配。
发布于 2014-07-09 17:35:29
我遇到了这个问题,我花了很长时间才在我的代码中解决它。
第一件事是我有UpdatePanel和一个jquery对话框。下面是我正在使用的脚本。
<script>
var uiDialog = $('.ui-dialog-container').parent();
(uiDialog.next().length && uiDialog.appendTo((document.forms.item(0) != null) ? document.forms.item(0) : document.body));
//verifyUser();
function ShowDialog() {
dialog = $("#dialog-form").dialog({
autoOpen: true,
resizable: false,
height: 400,
width: 800,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
}
});
}
</script>
这是表格
<div id="dialog-form" title="Verify Transaction" style="display:none;" >
<asp:ScriptManager ID="ScriptManager2" runat="server" />
<fieldset style="background-color:#ffd800;border-radius:5px;">
<label for="fname">First Name :</label>
<label for="fname"><%= DetailsView1.Rows[7].Cells[1].Text %></label><br />
<label for="lname">Last Name :</label>
<label for="lname"><%= DetailsView1.Rows[9].Cells[1].Text %></label><br />
<label for="zip">Zip Code :</label>
<label for="zip"><%= DetailsView1.Rows[22].Cells[1].Text %></label><br />
</fieldset>
<hr />
<asp:Button id="btnVerified" runat="server" OnClick="btnVerify_Click" UseSubmitBehavior="false" Text="Verified" />
<asp:Button ID="btnCancelled" runat="server" OnClientClick="dialog.dialog('close')" Text="Cancelled" UseSubmitBehaviour="false"/>
</div>
在这里我们可以看到,我在Button控件中使用了服务器端和客户端脚本。重要的是从对话框中删除表单标签,将脚本放在UpdatePanel中,并将UseSubmitBehaviour=设置为“false”。这将导致对话框回发,这是我们需要转到服务器端的内容。
最初我有表单标签。删除表单标记后,它将执行events、OnClientClick和OnClick服务器端执行的事件。干杯!!如果任何机构都有这个问题,这里就是解决方案。
最终解决了以下问题:
使用jQuery-UI对话框弹出的
注意:我在表单中使用了DetailsView控件。
干杯!!
https://stackoverflow.com/questions/15950091
复制相似问题