2011-08-04 21 views
1

私は更新パネル内にリストビューとデータポーカーを持っています。ボタンタイプはボタンとして設定されています。問題は、次へ/前へボタンをクリックしたときに次のエラーが発生することです。ボタンタイプがデータペイジャーのボタンの場合、無効なポストバック

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. Event validation is enabled using 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.

私はいくつかの検索を行い、EventValidationをfalseに設定する必要があることを発見しました。しかし、私はこれを行うときに空白のページを取得します。

どうすればいいのか教えてください。

ありがとうございます。

+0

は "<%@ページEnableEventValidation =" 偽のイベントの検証をオフにしてください"%>。メインコードブロックを表示すると良いでしょう。 – vladimir77

答えて

2

「EnableEventValidation = true」は、POST要求の改ざん(POSTインジェクション攻撃)からのA​​SP.NET保護です。あなたの場合、このエラーはクライアント側のページマークアップを動的に変更することを指します。

このオプションを無効にすることで問題を解決できます - <%@ Page EnableEventValidation = "false"%>、またはイベントをRegisterForEventValidationで登録してください。 Page_Loadイベント

if (!IsPostBack) 
    { 
    BindData(); 
    } 

そしてListViewsPagePropertiesChangedイベントを変更し忘れていないで、このコードを入れ

4

protected void lstProducts_PagePropertiesChanged(object sender, EventArgs e) 
    { 
     BindData(); 
    } 
関連する問題