private void BindGrid() { string sortField = VRGrid.Columns[VRGrid.SortColumnIndex].SortField; string sortDirection = VRGrid.SortDirection; DataTable table = GetUserInfoDateTable(); DataView TableView = table.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); VRGrid.DataSource = TableView; VRGrid.DataBind(); }
/// <summary> /// 数据绑定 /// </summary> private void BindGrid() { string sortField = VRGrid.Columns[VRGrid.SortColumnIndex].SortField; string sortDirection = VRGrid.SortDirection; DateTime starttime = dpStartDate.SelectedDate.Value; DateTime endtime = dpEndDate.SelectedDate.Value; if (!string.IsNullOrEmpty(dpStartDate.Text) && !string.IsNullOrEmpty(dpEndDate.Text) && starttime >= endtime) { FineUI.Alert.Show("结束日期必须大于等于开始日期"); return; } DataTable table = GetUserInfoDateTable(starttime.ToString(), endtime.AddHours(23).AddMinutes(59).ToString()); DataView TableView = table.DefaultView; TableView.Sort = String.Format("{0} {1}", sortField, sortDirection); VRGrid.DataSource = TableView; VRGrid.DataBind(); }