例如我在后台有个 public List<Customer> GetCustomerList(Customer param){}
这样一个方法,我要在前台获取这个方法的list然后循环将数据增充到页面中,
在网上找了下说通过web service 那不是每个方法都要写一个web service ?
这样一个方法,我要在前台获取这个方法的list然后循环将数据增充到页面中,
在网上找了下说通过web service 那不是每个方法都要写一个web service ?
解决方案 »
- datatable remove移除列问题。
- 求typeof()把FORM当参数传递
- B/S 架构分层 是否越多越好
- 如果是在微软操作系统下开发软件,大家一般用的是微软的哪个操作系统开发软件的?如何才能使自己开发出来的软件能在微软的各种操作系统下
- 关于设定时间,自动取数的问题
- 如何监测到用户不再使用当前控件(WinForm编程)
- 有很高参考价值的软件源码 请参看 成熟商业 财务进销存早期版本源码分享(30M完全C#) 每信必复
- 关注一下程序员自己做的网站(散分!)
- webbrowser能不能设置webbrowser_Completed事件和加载结束后执行脚本的顺序
- 怎样用C#生成实现特定接口OLE控件
- Winform 三层做的酒店实时房态图用按钮怎么做?
- 做局域网聊天室碰到点难题
返回是一个list 然后我在前台一个文本框绑定一个blur事件
$("#TB_type").blur(function(){
$.ajax({
type: "POST",
url: "RecordAskPrice.aspx/GetCustomer",
data: "{':''}",
contentType: "application/json; charset=utf-8",
success: function(msg)
{
alert(msg);
}
})怎么不对呀
引用ScriptManage控件JS代码:PageMethods.GetStr(str,function(result){//参数个数可选,逗号分隔
//回调函数
}
);CS代码:
using System.Web.Severs;[WebMethod]
public static string GetStr(string str)
{}
type: "POST",
contentType: "application/json",
url: "Menu.aspx/CheckChildMenuName",
data: "{ParentID:'" + MenuID + "',ProjectID:'<%=this.SortProjectID %>'}",
dataType: 'json',
async: false, //ajax同步
success: function(result) {
temp = result.d;
}
});CheckChildMenuName代表后台 方法ParentID,ProjectID后台方法参数[WebMethod]
[ScriptService]
public .....: Eson.UMS.Common.UmsBasePage
{
public static string CheckChildMenuName(string ParentID, string ProjectID)
{}
}
$("#TB_content").blur(function(){
$.ajax({
type: "POST",
contentType: "application/json",
url: "Default.aspx?fname=GetInfo",
data:"{':'}",
dataType: 'json',
async: true,
success: function(result) {
alert(result);
}
});
});
}); //
这句明明已经有了 GetInfo 里面的值了,但是 alert不出来呀 我应该怎么获取这个值呀
<script type="text/javascript">
$(function() {
$.ajax({
url: "xxx.aspx",
dataType: "json",
type: "GET",
error: function() {
alert("ERROR");
},
success: function(data) {
showDom(data);
}
});
}); var showDom = function(obj) {
$("#DivTable").find("tbody:last").find("tr").remove();
var domStr = "";
$.each(obj.ListInfo, function(i, v) {
domStr += "<tr><td>" + v.ID + "</td><td>" + v.Name + "</td><td>" + v.Sex + "</td></tr>";
});
$("#DivTable").find("tbody:last").append(domStr);
}
</script><body>
<form id="form1" runat="server">
<div>
<table id="DivTable" class="table">
<thead>
<tr>
<th>编号</th>
<th>姓名</th>
<th>性别</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</form>
</body>
xxx.aspx:String str = "{ListInfo:[";
for (Customer one in listin)
{
str += "{ID:\""+one.Id.ToString()+"\",Name:\""+one.Name.ToString()+"\",Sex:\""+one.Sex.ToString()+"\",";
}
str = str.Substring(0, str.Length - 1) + "]}";
Response.Write(str);
Response.Flush();
alert("ERROR");
},
那xxx.aspx 用Handler.ashx试试