Я пытаюсь отфильтровать набор данных ASP.net, используя параметры из выпадающего списка (какое поле фильтровать) и текстовое поле (для критериев).
Вот код клиента:
</p>
<pre><code>$("#btnFilter").click(function(){
$.ajax({
type: "POST",<br/>
url: "Default.aspx/selectFrom",<br/>
data: "{field:" + $("#ddl1").val() + ", criteria:" + $("#txt1").val() + "}",<br/>
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {<br/>
$("#gvHere").html(msg.d);
},<br/>
error: function() {
alert("Failed to sort table");
}
});
(Я хотел бы также добавить свою HTML-страницу, но не могу, потому что сам вопрос является HTML, и я не могу его отключить ...)
В любом случае, при попытке нажать кнопку фильтра - появляется досадная страница об ошибке ASP.net с трассировкой стека:
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using in configuration or 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.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2132728
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108
System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) +55
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +353
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194
Кто-нибудь знает, что я делаю не так?
Заранее спасибо!