我,每次我打F5再现了稳定的错误: 无效ViewState的错误时EnabledEventValidation是
有2个网格(主 - 详细信息)和错误实际发生的回调当主网格发生焦点行更改事件时,由我的客户代码引发。事情是这样的:
this.mainGrid.ClientSideEvents.FocusedRowChanged = string.Format(@"
function(s, e)
{{
if (typeof({0}) != 'undefined')
{0}.PerformCallback(s.GetFocusedRowIndex());
}}",
this.detailsGrid.ClientInstanceName);
的错误只再现了Mozilla Firefox浏览器! (是的,IE没有受到质疑,这是有点怪=))
而且很重要的东西:错误,只有当事件验证是再现,那就是:
... EnableEventValidation="false" %> // no error in this case
我建议原因是得到加载必要的字段前的回调被炒鱿鱼(因为我得到它,事件验证使用一些隐藏字段),所以我检查,使用setTimeout
:
this.mainGrid.ClientSideEvents.FocusedRowChanged = string.Format(@"
function(s, e)
{{
window.setTimeout(function() {{
if (typeof({0}) != 'undefined') {0}.PerformCallback(s.GetFocusedRowIndex());
}}, 2000);
}}",
this.detailsGrid.ClientInstanceName);
但是TAT没有帮助。 2秒通过,回调开始,我收到错误。 它仅在刷新时发生 - 第一次加载页面时不会引发错误。 禁用行缓存的网格也没有帮助。 需要帮助! =))
编辑:这里的堆栈跟踪
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded()
at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
at System.Web.UI.WebControls.HiddenField.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.WebControls.HiddenField.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.solutions_cashcenter_stockmanagement_frames_takeintostorageordersviewframe_aspx.ProcessRequest(HttpContext context) in c:\Users\udod\AppData\Local\Temp\Temporary ASP.NET Files\website\b07be668\e534e3ef\App_Web_jeqyhxze.10.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
EDIT2: 'EnsureEventValidationFieldLoaded' - 是的,我看到了这一点,但是......怎么可能,如果我等待2秒钟就不会被加载???编辑3:您可能会注意到这不是IIS问题(屏幕截图上的127.0.0.1 ip)。
编辑:UP !!!
男人,非常感谢你!我甚至都不知道你是怎么找到这个的(我的意思是这篇文章),因为我一直在寻找web解决方案,整天都没有结果)但是这真的是firefox自动填充隐藏输入的原因。再次谢谢你! –
Idk如果我可以手动奖励答案,但我会明天尝试。 –