private void bindEvaluatedToGrid() { string exception = ""; DataTable table = new DataTable(); if (DropDownList_Depart.SelectedValue == "0") { if (PostBookManagementCtrl.GetAll(ref table, ref exception)) { table = dataTableFilter(table); string sortField = Grid1.SortField; string sortDirection = Grid1.SortDirection; DataView dv = table.DefaultView; dv.Sort = String.Format("{0} {1}", sortField, sortDirection); Grid1.DataSource = dv; Grid1.DataBind(); } else { table.Clear(); Grid1.DataSource = table; Grid1.DataBind(); //Alert.ShowInTop("获取被考评人信息失败!/n原因:" + exception, MessageBoxIcon.Error); } } else { string depart = DropDownList_Depart.SelectedValue; if (PostBookManagementCtrl.GetAllByDepart(ref table, depart, ref exception)) { table = dataTableFilter(table); string sortField = "Status"; string sortDirection = "ASC"; DataView dv = table.DefaultView; dv.Sort = String.Format("{0} {1}", sortField, sortDirection); Grid1.DataSource = dv; Grid1.DataBind(); } else { table.Clear(); Grid1.DataSource = table; Grid1.DataBind(); //Alert.ShowInTop("获取被考评人信息失败!/n原因:" + exception, MessageBoxIcon.Error); } } }
/// <summary> /// 绑定被考评人信息到Grid /// </summary> private void bindEvaluatedToGrid() { string exception = ""; string depart = (string)Session["Depart"]; DataTable table = new DataTable(); if (PostBookManagementCtrl.GetAllByDepart(ref table, depart, ref exception)) { table = dataTableFilter(table); string sortField = Grid1.SortField; string sortDirection = Grid1.SortDirection; DataView dv = table.DefaultView; dv.Sort = String.Format("{0} {1}", sortField, sortDirection); Grid1.DataSource = dv; Grid1.DataBind(); } else { table.Clear(); Grid1.DataSource = table; Grid1.DataBind(); } }