首页 > 代码库 > gridview动态生成列
gridview动态生成列
// 有连接的列 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); }
gridview动态生成列
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。