/// <summary> /// /// </summary> void BindingGrid() { DataTable dt = LogQueryHelper.GetMonitorGraphReadingRoomList(this.LoginId); string sortField = gridRoomList.Columns[gridRoomList.SortColumnIndex].SortField; string sortDirection = gridRoomList.SortDirection; DataView TableView = dt.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); gridRoomList.DataSource = TableView; gridRoomList.DataBind(); }
/// <summary> /// 主页列表 /// </summary> /// <returns></returns> private string MonitorGraphModeDataBind() { string result = ""; DataTable dt = LogQueryHelper.GetMonitorGraphReadingRoomList(this.LoginId); StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("\"form.paginate.pageNo\": 1,"); sb.Append("\"form.paginate.totalRows\": 100,"); sb.Append(" \"rows\": ["); foreach (DataRow item in dt.Rows) { sb.Append("{\"roomNum\": \"" + item["roomNum"].ToString() + "\",\"roomName\": \"" + item["roomName"] + "\",\"libraryName\": \"" + item["libraryName"] + "\",\"seatCountAll\": \"" + item["seatCountAll"] + "\",\"seatCountUsed\": \"" + item["seatCountUsed"] + "\",\"seatCountShortLeave\": \"" + item["seatCountShortLeave"] + "\"}"); sb.Append(","); } sb.Remove(sb.Length - 1, 1); sb.Append("]"); sb.Append("}"); string data = sb.ToString(); ViewBag.Data = data; return(result); }