我想使用dropdownlist中的参数(要过滤的字段)和文本框(符合条件)来过滤ASP.net DataSet。
这是客户代码:
$("#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");
}
});
$("#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
有谁知道我做错了什么?
提前致谢!