Display rows in multiple columns in Asp.net Gridview

时光总嘲笑我的痴心妄想 提交于 2019-12-04 03:39:25
Serhat Ozgel

You can use a DataList control instead. It has a RepeatColumns property that you can define the number of columns you want to display.

In .NET Framework 3.5, there is an even better solution, the ListView control. You can find further information about how to use the ListView control here.

If this is a pure coding exercise, then bind to the RowDataBound event of the Gridview. That way, you can do:

e.Row.Cells(2).Text = e.Row.Cells(1).Text

This would place the text from column 1 in column 2 after it has been pulled from the database. You can also dynamically create columns using a similar method.

Re-reading, I think I misunderstand your problem though.

Can't you just put two identical bound columns one after the other?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!