c# - 访问 AutoGenerated GridView 的所有列 - ASP.NET

标签 c# asp.net gridview autogeneratecolumn

我有一个启用了自动生成功能的简单 Gridview。我需要知道如何访问这些列,因为列计数始终为零,即使它们显示在页面中也是如此。

我发现了一些关于“AutoGeneratingColumn”事件的信息,但那是针对 DataGrids 的,一次只能访问一列。

基本上我需要使用 agrinei 的 GridViewHelper 来对行进行分组。

什么不起作用:

DataBound 事件、PreRender 事件、RowCreated 事件(因为我需要所有列)和Load 事件.

最佳答案

自动生成的列不会显示在 Columns 集合中 by design ,正如您发现的那样。我没试过,但是here's an article about subclassing the Gridview并将这些自动生成的列添加到 Columns 集合中。可能会帮助你。

关于c# - 访问 AutoGenerated GridView 的所有列 - ASP.NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6940946/

相关文章:

c# - Windows 上的蓝牙 SPP 服务器

c# - 网络核心 : Type or namespace name 'RoleProvider' could not be found

c# - 彩票入场方式

asp.net - 将 .NET Core Web 应用程序部署到 Azure 时出错

android - 如何制作像redbus一样的座位预订布局

C# : how to set stored procedure execution with parallelism or improve execution time?

c# - 如何捕获整个查询字符串?

asp.net - ashx 处理程序 DELETE 请求不起作用 HTTP 405.0

c# - 垂直滚动出现在 GridView 中

android - 如何确保更改所选 GridView 单元格的背景?