인기 항목에 대해 많이 읽었습니다. 잘못된 다시 게시 또는 콜백 인수 오류 메시지.GridView.DataBind 호출 중에 사용자가 클릭하면 ArgumentException이 발생 함
어떤 유형의 링크/리디렉션 (이 경우 ASP LinkButton이나 ASP 단추를 사용할 때도 같은 결과가 발생 함)을 클릭하여 웹 페이지를 급히 보내면 웹 페이지 GridView가 데이터를 완료하기 전에이 오류가 발생합니다 제본.
바인딩되는 데이터가 매우 커서 이상적으로 페이징을 추가하여 실행 속도를 향상시켜야합니다. 그러나 클릭 외에도 클라이언트 스크립트를 포함하여 수정되는 추가 데이터가 없으므로이 오류가 발생하는 이유가 확실하지 않습니다.
전체 오류 : I 보안상의 이유로 이벤트 유효성 검사를 해제하고 싶지 않아 내가 큰 데이터 바인딩 작업이 그 이유라고 알고 있지만 내가 왜 모르는
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.
.
나는 또한 간단한 테스트로 그리드 유효성 검사를하지 않도록 노력했다하지만,이 문제가 해결되지 않은 :
myGrid.ValidateRequestMode = ValidateRequestMode.Disabled
하는 LinkButton이 하지이 PostBackUrl
를 사용하는 대신 Click 이벤트 + Response.Redirect
(I을 사용을 모든 관련없는 코드를 삭제했습니다.)
데이터 블록이 수행되기 전에보다 LinkButton이 으로 생성됩니다.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim application As IApplication
If Not IsPostBack Then
application = Session("App")
If application IsNot Nothing Then
AddLinkButton("Test", "EntityPage", CommandType.PageLink)
ShowData(application)
End If
End If
End Sub
Private Sub AddLinkButton(label As String, commandArgument As String,
Optional command As CommandType = CommandType.Link)
Dim linkBtn As New LinkButton()
linkBtn.Text = label
linkBtn.CssClass = "myLinkBtn"
linkBtn.CommandName = command.ToString
linkBtn.CommandArgument = commandArgument
AddHandler linkBtn.Click, AddressOf LinkButton_Click
panel.Controls.Add(linkBtn)
End Sub
Private Sub LinkButton_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim linkBtn As LinkButton = CType(sender, LinkButton)
Select linkBtn.CommandName
Case "Link" :
Response.Redirect(linkBtn.CommandArgument, False)
' more cases + additional logic that I removed from the example
End Select
End Sub
Friend Sub ShowData(application As IApplication)
Dim entities As List(Of Entity)
If Not IsPostBack Then
entities = application.GetEntities()
myGridView.DataSource = entities
myGridView.DataBind()
End If
End Sub
왜 이런 현상이 발생했다고 생각하십니까? 그리고 데이터 바인딩을 성공적으로 방해 할 수있는 방법이 있습니까?
편집 : 또한 LinkButton 대신 Button을 사용하고 UseSubmitBehavior = True
을 사용했지만 동일한 결과가 나타납니다.
것은 단지 만듭니다 그래서 당신은 거 야
AddLinkButon
서브 없애 및 파일 뒤에 코드 내에서 다음을 추가해야합니다 링크 (!) (a-tag)를 사용하고 linkbutton을 사용하지 마십시오. Linkbutton은 포스트 백을 발생 시키며, link-tag는 발생하지 않습니다. 포스트 백은 사용자가 다른 페이지로의 링크를 따라 가기를 원하기 때문에 여기서 필요하지 않습니다. 포스트 백은 전체 페이지를 다시 구문 분석 할 서버에 게시합니다. 이는 시간 소모적이거나 비효율적이며 여기서는 필요하지 않습니다. – Esko@Esko이 작업은 "LinkButton_Click"이벤트 처리기를 실행할 수있게 할 수 있습니까? – Mayron
리디렉션 이외의 다른 작업을 수행하지 않는 경우, 이전에해야 할 일은 무엇입니까? – Esko