2011-08-04 3 views
1

업데이트 패널 내에 listview 및 datapager가 있습니다. 단추 유형은 단추로 설정됩니다. 이제 문제는 다음/이전 버튼을 클릭 할 때 다음 오류가 발생한다는 것입니다.버튼 유형이 올바르지 않은 포스트 백이 데이터 플레이어의 버튼

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'는 ASP.NET 요청이 POST 요청 (POST 주입 공격)을 변경하지 못하도록합니다. 귀하의 경우이 오류는 클라이언트 측에서 동적으로 페이지 마크 업을 변경하는 것을 가리 킵니다.

이 옵션을 사용하지 않음으로써 문제를 해결할 수 있습니다 (< % @ Page EnableEventValidation = "false"%>) 또는 이벤트를 RegisterForEventValidation에 등록하십시오.

4

Page_Load 이벤트

if (!IsPostBack) 
    { 
    BindData(); 
    } 

에이 코드를 넣고 ListViewsPagePropertiesChanged 이벤트 수정 잊지 마세요 :에서 이벤트 유효성 검사를 전환 할

protected void lstProducts_PagePropertiesChanged(object sender, EventArgs e) 
    { 
     BindData(); 
    } 
관련 문제