为什么ligerui无法接收URL的数据,直接给Data赋值就可以
2个回答
展开全部
Html代码:
XML/HTML code?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../lib/jquery/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="../lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<link href="../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="../lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="../lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" >
// var jsonObj = {};
// jsonObj.Rows=[
// {"Id":"1001","Name":"张三","Pwd":"1234"},
// { "Id": "1002", "Name": "张三1", "Pwd": "1234" },
// { "Id": "1003", "Name": "张三2", "Pwd": "1234" }
// ];
function itemclick(item) {alert(item.text);}
$(document).ready(function () {
window['g'] = $("#maingrid").ligerGrid({
height: '100%',
columns: [
{ display: '编号', name: 'Id', align: 'center', width: 100 },
{display:'姓名',name:'Name',minWidth:120},
{display:'密码',name:'Pwd',minWidth:100}
],
// data: jsonObj,
url: "../HanderPost/userInfo.ashx",
pageSize:10,rowNumbers:true,
toolbar:{
items:[
{text:'增加',click:itemclick,icon:'add'},
{line:true},
{text:'修改',click:itemclick,icon:'modify'},
{line:true},
{text:'删除',click:itemclick,icon:'add'}
]
}
}
);
$("#pageloading").hide();
});
</script>
</head>
<body style="overflow:hidden;padding:2px;">
<div class="l-loading" style="display:block" id="pageloading"></div>
<div class="l-clear"></div>
<div id="maingrid"></div>
</body>
<
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
GetDataDataContext db = new GetDataDataContext();
IQueryable<UserList> userInfos = from u in db.UserList select u;
List<UserList> userLists = userInfos.ToList();
string jsonString = JsonHelper.JsonSerializer<List<UserList>>(userLists);
//context.Response.Write("{\"Rows\":" + jsonString + "}");
// context.Response.Write("{\"Rows\":" + jsonString + "}");
string json = @"{""Rows"":" + jsonString + @",""Total"":""" + userLists.Count() + @"""}";
context.Response.Write(json);
context.Response.End();
}
/html>
XML/HTML code?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../lib/jquery/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="../lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<link href="../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="../lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="../lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" >
// var jsonObj = {};
// jsonObj.Rows=[
// {"Id":"1001","Name":"张三","Pwd":"1234"},
// { "Id": "1002", "Name": "张三1", "Pwd": "1234" },
// { "Id": "1003", "Name": "张三2", "Pwd": "1234" }
// ];
function itemclick(item) {alert(item.text);}
$(document).ready(function () {
window['g'] = $("#maingrid").ligerGrid({
height: '100%',
columns: [
{ display: '编号', name: 'Id', align: 'center', width: 100 },
{display:'姓名',name:'Name',minWidth:120},
{display:'密码',name:'Pwd',minWidth:100}
],
// data: jsonObj,
url: "../HanderPost/userInfo.ashx",
pageSize:10,rowNumbers:true,
toolbar:{
items:[
{text:'增加',click:itemclick,icon:'add'},
{line:true},
{text:'修改',click:itemclick,icon:'modify'},
{line:true},
{text:'删除',click:itemclick,icon:'add'}
]
}
}
);
$("#pageloading").hide();
});
</script>
</head>
<body style="overflow:hidden;padding:2px;">
<div class="l-loading" style="display:block" id="pageloading"></div>
<div class="l-clear"></div>
<div id="maingrid"></div>
</body>
<
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
GetDataDataContext db = new GetDataDataContext();
IQueryable<UserList> userInfos = from u in db.UserList select u;
List<UserList> userLists = userInfos.ToList();
string jsonString = JsonHelper.JsonSerializer<List<UserList>>(userLists);
//context.Response.Write("{\"Rows\":" + jsonString + "}");
// context.Response.Write("{\"Rows\":" + jsonString + "}");
string json = @"{""Rows"":" + jsonString + @",""Total"":""" + userLists.Count() + @"""}";
context.Response.Write(json);
context.Response.End();
}
/html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
获取表单数据:
var form = liger.get("form1");
var data = form.getData();
alert(liger.toJSON(data));
设置表单数据:
var form = liger.get("form1");
form.setData({
Title: '标题1111',
addDate: new Date(),
Country : 'ZG'
});
ashx 应该写成和form 表单中元素name对应的各个参数,类似
public string Receive(string Title, DateTime addDate, string Country)
{
}
前台提交表单可以用jquery.form.js 这个插件,ajax 异步提交表单
var form = liger.get("form1");
var data = form.getData();
alert(liger.toJSON(data));
设置表单数据:
var form = liger.get("form1");
form.setData({
Title: '标题1111',
addDate: new Date(),
Country : 'ZG'
});
ashx 应该写成和form 表单中元素name对应的各个参数,类似
public string Receive(string Title, DateTime addDate, string Country)
{
}
前台提交表单可以用jquery.form.js 这个插件,ajax 异步提交表单
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询