Art*_*dod 3 asp.net viewstate firefox eventvalidation
我有一个稳定的错误,每次击中F5时都会重现:
有两个网格(主 - 细节),当主网格上发生聚焦行更改事件时,我的客户端代码引发的回调实际上发生了错误.像这样的东西:
this.mainGrid.ClientSideEvents.FocusedRowChanged = string.Format(@"
function(s, e)
{{
if (typeof({0}) != 'undefined')
{0}.PerformCallback(s.GetFocusedRowIndex());
}}",
this.detailsGrid.ClientInstanceName);
Run Code Online (Sandbox Code Playgroud)
这个bug只能在mozilla firefox中重现!(是的,IE没有问题,这有点奇怪=))
非常重要的是:只有当事件验证开启时,bug才会重现,即:
... EnableEventValidation="false" %> // no error in this case
Run Code Online (Sandbox Code Playgroud)
我建议原因是在必要的字段加载之前回调被触发(因为我得到它,事件验证使用一些隐藏的字段),所以我检查了使用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);
Run Code Online (Sandbox Code Playgroud)
但是tat并没有帮助.2秒后,回叫开始,我收到错误.它仅在刷新时发生 - 第一次加载页面时不会引发错误.禁用网格的行缓存也没有帮助.需要帮助!=))
编辑:这是StackTrace
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)
Run Code Online (Sandbox Code Playgroud)
Edit2:' EnsureEventValidationFieldLoaded ' - 是的,我看到了这一点,但是...如果我等了2秒怎么能不加载?
编辑3:您可能会注意到这不是IIS问题(屏幕截图上为127.0.0.1 ip).
编辑:UP!
小智 6
昨天我遇到了同样的错误,发现了类似的问题:http://sietch.net/ViewNewsItem.aspx?NewsItemID = 185
我目前的解决方法是:
$(document).ready(function(){
$('#__EVENTVALIDATION').attr('autocomplete', 'off');
});
Run Code Online (Sandbox Code Playgroud)
它似乎工作.但我还在测试.
归档时间: |
|
查看次数: |
2265 次 |
最近记录: |