DataGrid的按钮 - 无效的回发或回调 [英] DataGrid button - Invalid Postback or Callback

查看:133
本文介绍了DataGrid的按钮 - 无效的回发或回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了的列数,并在该行的最后一个复选框和列的一个DataGrid。

I have setup a DataGrid with a number of columns and a checkbox and column at the end of the row.

我也改变在其通过与行跨度属性扩展行改变了DataGrid的布局 OnItemCreated 事件DataGrid的布局和删除多余的列和控制他们不再需要

I am also changing the layout of the datagrid on the OnItemCreated event which changes the layout of the datagrid by expanding the rows with the "Rowspan" attribute and remove the extra columns and controls where they are no longer required.

最初的数据网格布局是设置是这样的:

The original datagrid layout was setup like this:

___________________________________________
| 1 | Employee Name | 01/08/10 |[] |[SAVE]|
| 1 | Employee Name | 02/08/10 |[] |[SAVE]|
___________________________________________
| 2 | Employee Name | 01/08/10 |[] |[SAVE]|
___________________________________________
| 3 | Employee Name | 04/08/10 |[] |[SAVE]|
| 3 | Employee Name | 05/08/10 |[] |[SAVE]|
| 3 | Employee Name | 06/08/10 |[] |[SAVE]|
___________________________________________
| 4 | Employee Name | 03/08/10 |[] |[SAVE]|
___________________________________________

而现在它看起来像这样具有扩展行,对照删除,数据网格列删除...

And now it looks like this with the rows expanded, the controls removed and the datagrid columns deleted...

___________________________________________
| 1 | Employee Name | 01/08/10 |[] |[SAVE]|
|   |               | 02/08/10 |   |      |
___________________________________________
| 2 | Employee Name | 01/08/10 |[] |[SAVE]|
___________________________________________
| 3 | Employee Name | 04/08/10 |[] |[SAVE]|
|   |               | 05/08/10 |   |      |
|   |               | 06/08/10 |   |      |
___________________________________________
| 4 | Employee Name | 03/08/10 |[] |[SAVE]|
___________________________________________

打开时,该页面显示,每个用户点击页码时间预期寻呼控制工程。

The page displays when opened, and the paging control works as expected each time a user clicks on a page number.

然而,当我点击[保存]按钮,将特定的员工,错误消息显示类似的消息无效的回发或回调。据我所知,这是我在DataGrid和事件验证不匹配,还原最初呈现的项目已删除的控件和列的结果。

However, when I click on the [SAVE] button for a particular employee, an error message shows a message similar "Invalid Postback or Callback". I understand that this is a result of the controls and columns that I have removed in the datagrid and the event validation does not match the orignal rendered items.

我不想删除EnableEventValidation,因为它是一个安全问题。

I do not want to remove the EnableEventValidation because it is a security issue.

我知道我必须使用Render方法来解决,我已经在显示页面之前所做的任何更改,但我要如何解决这个问题,回传?

I know I have to use the Render method to fix any changes that I have made before the page is displayed, but how do I resolve this postback issue?

推荐答案

好吧,让我们看看那里的错误正在添加从

Ok, lets see where the error comming from.

GridView控件是使用__doPostBack()javascript调用,并有他自身没有输入。因此,通过他的自我不能从其他细胞发送任何输入数据。

The GridView is use the __DoPostBack() javascript call and have no input by him self. So by him self is not send any input data from other cells.

现在我觉得你没有做定制DoPostBack电话 - 右

的第二点,有一个验证是上视图状态数据。

The second point that there is a validation is on ViewState Data.

时的任何改变使用任何的UpdatePanel并在中间你做任何更新该改变这种ViewState的?

Is by any change to use any UpdatePanel and in the middle you make any update that change this ViewState ?

我建议你尝试是发送的EnableViewState =false的在你的GridView要看到,如果你仍然得到这个错误。这不会影响你,因为GridView控件在每次更新重读需要创建的数据。

What I suggest you to try is to send EnableViewState="false" on your GridView To see if you still get this error. This is not affect you because GridView in every update re-read the data that needs to created.

和,你需要检查的第二点,就是你改变你的数据和afect视图状态的地步。也许通过地方在其他点解决问题。从例如,如果您有它的Page_Load也许你需要把它移到上PageInit - 或者反之亦然

And the second point that you need to check, is the point that you change your data and afect the view state. Maybe by place it in other point solve the issue. From example if you have it on Page_Load maybe you need to move it on PageInit - or vise versa.

希望这有助于。

这篇关于DataGrid的按钮 - 无效的回发或回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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