鍥2:
鍥1锛
娉ㄦ剰浜嬮」
鏄剧ずJQUBAR鎻掍欢椤甸潰鐨刪tml鏍囧噯璇蜂娇鐢 锛孧VC2.0 C#浠g爜浣跨敤NORTHWIND鏁版嵁搴撱侸QUBar1.1鎻掍欢鍦ㄨ繖閲屼笅杞姐
绋嬪簭鎴浘
1.1鐗堟湰淇浜嗛儴鍒哹ug锛屽悓鏃舵柊澧炰互涓嬪姛鑳斤細1.鍙嚜瀹氫箟鍧愭爣棰滆壊
2.鍙嚜瀹氫箟X,Y杞村潗鏍囧悕绉
3.Y杞村姩鎬佸潗鏍囪嚜鍔ㄥ缓绔
4.Y杞村姩鎬佸潗鏍囧艰嚜鍔ㄨ绠
5.鎻掍欢鏍峰紡鍗囩骇
JQUBAR1.1浣跨敤鏂规硶锛
1.寮曞叆Javascript鏂囦欢鍙奀SS鏂囦欢锛
锛堝湪html鍔犲叆浠ヤ笅浠g爜锛屼互ASP.NET MVC 2.0 涓轰緥锛
鏂囩珷鏉ヨ嚜 codego.net 璇风湅婧愪唬鐮:
" rel="stylesheet" type="text/css" />
2.鍦╤tml鍔犲叆浠ヤ笅javascript浠g爜:
鏂囩珷鏉ヨ嚜 codego.net 璇风湅婧愪唬鐮:
3.鍔犲叆HTML浠g爜锛
鏂囩珷鏉ヨ嚜 codego.net 璇风湅婧愪唬鐮:
<%--JQUBAR瀹瑰櫒--%>
濮撳悕妯$硦鏌ヨ锛
4.MVC2.0 C#浠g爜锛
鏂囩珷鏉ヨ嚜 codego.net 璇风湅婧愪唬鐮:
private NORTHWINDDataContext _Context = new NORTHWINDDataContext();
private decimal[] GetPricesByEmployeeId(int employeeId)
{
decimal[] result = null;
result = _Context.Orders.Where(o => o.EmployeeID == employeeId).Take(5)
.Select(oo => (decimal)oo.ShipVia).ToArray();
return result;
}
public JsonResult LoadData(string name)
{
var data = (from e in _Context.Employees.Take(10).ToList()
select new
{
EmployeeID = e.EmployeeID,
Orders = GetPricesByEmployeeId(e.EmployeeID),
Name = e.FirstName,
}).Distinct();
if (!string.IsNullOrEmpty(name))
{
data = data.Where(d => d.Name.IndexOf(name) >= 0);
}
return Json(new { Success = true, Msg = data }, JsonRequestBehavior.AllowGet);
}