【发布时间】:2013-12-30 20:15:02
【问题描述】:
我希望得到一些帮助 - 我正在尝试从 Kendo 网格向我的 .asmx Web 服务发送请求。我有一个没有参数的版本,但我无法将参数传递给我的 Web 服务,或者至少不知道如何检索它们。 (注意:已编辑以反映解决方案)
// Here's how the transport part of the Kendo Grid looks:
transport: {
read: {
url: function (e) {
return "Documents.svc/Read?guid=" + guid + "&Name=" + name + "&Origin=" + origin + "&Groups=" + groups;
},
contentType: "application/json; charset=utf-8",
type: "POST"
},
parameterMap: function (data, operation) {
return JSON.stringify(data);
}
}
// And here's the web service:
[ServiceContract(Namespace = "")]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Documents
{
[OperationContract]
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public List<clsDocuments> Read(string guid, string name, string origin, string groups)
{
var Guid = HttpContext.Current.Request.QueryString["guid"];
var Name = HttpContext.Current.Request.QueryString["name"];
var Origin = HttpContext.Current.Request.QueryString["origin"];
var Groups = HttpContext.Current.Request.QueryString["groups"];
List<clsDocuments> docList = Utility.GetUnreadDocuments();
foreach (var doc in docList)
{
doc.Modified = DateTime.Parse(doc.Modified).ToShortDateString();
}
return docList;
}
}
【问题讨论】:
-
编辑到文档解决方案。
标签: c# web-services grid kendo-ui asmx