나는 다음과 같은 매우 간단한 형태했다 : 내 버튼의 클릭 핸들러에서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.|
: 어떤 식 으로든 무엇이든지,하지만, 난 여전히 다음과 같은 오류를 받고 있어요 뒤로, 나는 내 인생이 왜 내가 가진 것처럼 행동하는지 알 수 없다. 이견있는 사람?
사용중인 ASP.Net의 버전은 무엇입니까? UpdatePanel의 유효성 검사 컨트롤에 문제가있는 버전 하나를 기억하는 것 같습니다. 다른 validators.dll을 다운로드해야했습니다. 여기를 참조하십시오 : http://blogs.msdn.com/mattgi/archive/2007/ 05/12/validators-update-available.aspx – David
이것은 꽤 좋은 예제, 연습 및 설명을주었습니다. http://couldbedone.blogspot.com/2007/09/conditional-updatepanel-and-event.html – JoeManiaci