2010-02-23 3 views
0

나는 다음과 같은 매우 간단한 형태했다 : 내 버튼의 클릭 핸들러에서ASP.NET의 updatepanel + 무효 게시

<asp:UpdatePanel ID="ClaimRewardsForm" runat="server"> 
    <ContentTemplate> 
     <span class="largeBold">Select jacket weight:</span><br /> 
     <asp:RadioButtonList runat="server" ID="JacketWeight"> 
      <asp:ListItem Value="Lightweight" Text="Lightweight (fleece)" /> 
      <asp:ListItem value="Heavyweight" Text="Heavyweight (cotton)" />         
     </asp:RadioButtonList> 
     <br /> 
     <span class="largeBold">Select size:</span><br /> 
     (Men's sizes only)<br /> 
     <asp:DropDownList ID="JacketSize" runat="server"> 
      <asp:ListItem Value="Small" Text="Small" /> 
      <asp:ListItem Value="Medium" Text="Medium" /> 
      <asp:ListItem Value="Large" Text="Large" /> 
     </asp:DropDownList><br /> 
     <br /> 
     <asp:ImageButton ID="SubmitButton" runat="server" ImageUrl = "~/Content/Images/submitButton.png" onclick="SubmitButton_Click" /> 
    </ContentTemplate> 
</asp:UpdatePanel>  

있습니다

protected void SubmitButton_Click(object sender, EventArgs e) 
{ 
    if (IsValid) 
    { 
     using (var work = UnitOfWorkFactory.Create()) 
     { 
      var id = new Guid(Session["id"].ToString()); 
      var account = UserAccounts.Get(id); 

      if (account == null) 
       throw new Exception("Invalid user account id."); 

      account.RewardInfo.Clear(); 
      account.RewardInfo.Add(new RewardInfo() 
      { 
       UserAccount = account, 
       JacketWeight = JacketWeight.SelectedValue, 
       JacketSize = JacketSize.SelectedValue 
      }); 

      work.Commit(); 
     } 

     //ClaimRewardsForm.Update(); 
     //ScriptManager.RegisterStartupScript(this, GetType(), 
     // "confirmation", "ClaimRewards.showConfirmation();", true); 
    } 
} 

내가있는 양식 필드를 수정 아니에요 나는 포스트 동안 모든 TEH 컨트롤을 수정하고 있지 않다 때문에

505|error|500|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.| 

: 어떤 식 으로든 무엇이든지,하지만, 난 여전히 다음과 같은 오류를 받고 있어요 뒤로, 나는 내 인생이 왜 내가 가진 것처럼 행동하는지 알 수 없다. 이견있는 사람?

+0

사용중인 ASP.Net의 버전은 무엇입니까? UpdatePanel의 유효성 검사 컨트롤에 문제가있는 버전 하나를 기억하는 것 같습니다. 다른 validators.dll을 다운로드해야했습니다. 여기를 참조하십시오 : http://blogs.msdn.com/mattgi/archive/2007/ 05/12/validators-update-available.aspx – David

+0

이것은 꽤 좋은 예제, 연습 및 설명을주었습니다. http://couldbedone.blogspot.com/2007/09/conditional-updatepanel-and-event.html – JoeManiaci

답변

0

어리석은 나를. 내 DropDownList 어댑터를 사용하여 내 목록 내의 optiongroup 요소를 허용하지만 이벤트 유효성 검사를 위해 수정 된 값을 등록하지 않고 목록의 요소를 수정하기 때문에 잘못된 다시 게시가 발생했습니다. 등록을 수행하기 위해 어댑터를 수정 했으므로 이제는 제대로 작동합니다.

0

이 사람 here이 당신의 범인입니다. 보안 위험을 이해하면 요청을 차단하도록 게시하려는 내용을 파악하거나 EventValidation을 비활성화해야합니다.

게시 된 코드에는 아무 것도 표시되지 않지만, <> 옵션 값에서 확실히 혼란 스럽습니다.