IsPostBack即使在第一次加载页面时也是如此

编程入门 行业动态 更新时间:2024-10-27 12:39:35
本文介绍了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

解决方案

你试试这个 stackoverflow/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 stackoverflow/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即使在第一次加载页面时也是如此

本文发布于:2023-10-12 21:41:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485979.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   页面   IsPostBack

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!