I am tring to filter an ASP.net DataSet, using parameters from dropdownlist (which field to filter), and a textbox (for the criteria).
Here is the client 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");
}
});
(I would love to add also my html page but I cannot because the question itself is an HTML and I can't disable it... )
Anyway, when trying to click the filter button - I get an annoying ASP.net error page with stack trace:
[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
Does anyone knows what am I doing wrong?
Thanks in advance!