protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ////权限按钮方法 this.GetButtonPower(); ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); SpecialEquipmentService.InitSpecialEquipmentTypeDropDownList(this.drpType, true); // 绑定表格 BindGrid(); } }
/// <summary> /// 绑定数据 /// </summary> private void BindGrid() { var q = from x in Funs.DB.Base_SpecialEquipment orderby x.SpecialEquipmentCode select new { x.SpecialEquipmentId, x.SpecialEquipmentCode, x.SpecialEquipmentName, TypeName = SpecialEquipmentService.getTypeName(x.SpecialEquipmentType), x.SpecialEquipmentType, x.Remark, x.IsSpecial, }; Grid1.RecordCount = q.Count(); DataTable tb = this.GetPagedDataTable(Grid1, q); Grid1.DataSource = tb; Grid1.DataBind(); }