IsPostBack即使在第一次加载页面时也是如此 [英] IsPostBack coming as true even on the first time page load

查看:62
本文介绍了IsPostBack即使在第一次加载页面时也是如此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用下面的javascript方法将数据从一个页面传递到另一个页面并在那里阅读:



  function  GotoActivity(accountNumber,noteID){

var url = / ActivitySearch / Activity.aspx;
document .forms [ 0 ]。action = url;
document .forms [ 0 ]。Data1.value = accountNumber;
document .forms [ 0 ]。Data2.value = noteID;
document .forms [ 0 ] .__ VIEWSTATE.name = ' NOVIEWSTATE';
document .forms [ 0 ]。submit();
}





我能够在第二页成功获取Data1和Data2的值,但我面临两个问题这里:



1)当它导航到第二页时,它会给出黄页错误:



无效的回发或回调参数。使用配置中的< pages enableEventValidation =true/>或页面中的<%@ Page EnableEventValidation =true%>启用事件验证。为了安全起见目的,此功能验证回发或回调事件的参数来自最初呈现它们的服务器控件。如果数据有效且预期,请使用ClientScriptManager.RegisterForEventValidation方法注册回发或回调数据以进行验证。



如果我声明EnableEventValidation =false这个错误会发生,但我已经看到它写在几乎所有不推荐的地方。



2)在secong页面上,即使导航后第一次加载页面,IsPostBack属性也始终为True。



在此先感谢,

Deepti

解决方案

你试试这个

http://stackoverflow.com/questions/228969/ invalid-postback-or-callback-argument-event-validation-is-enabled-using-page [ ^ ]


我用的是jquery方法Post发布数据然后重定向到页面。它运作良好。


检查此链接

Hi,

I am using below javascript method to pass data from one page to another and reading it there:

function GotoActivity(accountNumber, noteID) {

    var url = "/ActivitySearch/Activity.aspx";
    document.forms[0].action = url;
    document.forms[0].Data1.value = accountNumber;
    document.forms[0].Data2.value = noteID;
    document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
    document.forms[0].submit();
}



I am able to get the values of Data1 and Data2 successfully on my second page but I am facing two problems here:

1) When it navigates to the second page it gives the yellow page with the error:

"Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation."

If I declare EnableEventValidation="false" this error goes but I have seen it written in almost all the places that it is not recommended.

2) On the secong page the "IsPostBack" property always comes as True even for the first time the page load after navigation.

Thanks in Advance,
Deepti

解决方案

did u try this
http://stackoverflow.com/questions/228969/invalid-postback-or-callback-argument-event-validation-is-enabled-using-page[^]


I used the jquery method Post to post the data and then redirect to the page. It worked well.


Check this Link


这篇关于IsPostBack即使在第一次加载页面时也是如此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆