// 有连接的列 if (!String.IsNullOrWhiteSpace(filedModel.C_SqlDetail)) { HyperLinkField hyperColumn = new HyperLinkField(); hyperColumn.HeaderText = filedModel.DisplayName; hyperColumn.DataTextField = filedModel.DisplayFiled; hyperColumn.NavigateUrl = "javascript:void(0);"; hyperColumn.Text = "详细"; string[] str = { filedModel.DisplayFiled }; hyperColumn.DataNavigateUrlFields = str; hyperColumn.DataNavigateUrlFormatString = "/Statistics/ScanStatisticsDetails?id=" + Request["param"] + "&detailId={0}"; gridStatistics.Columns.Add(hyperColumn); } // 普通列 else { BoundField newGridBoundColumn = new BoundField(); newGridBoundColumn.HeaderText = filedModel.DisplayName; newGridBoundColumn.DataField = filedModel.DisplayFiled; if (filedModel.Length != 0) { newGridBoundColumn.HeaderStyle.Width = filedModel.Length; } this.gridStatistics.Columns.Add(newGridBoundColumn); } dt.Columns.Add(filedModel.DisplayName); }