本文介绍了围绕数据单元格中的网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个gridview,我在运行时动态关联网格视图数据源
I have a gridview and i'm associating the datasource for the grid view dynamically at runtime
我的意思是
gridView2.DataSource = titlesArrayList; gridView2.DataBind();和我想在这个网格视图的单元中的数据为中心,现在他们正在左对齐
And i want the data in cells of this grid view to be centered, right now they are left-justified
如果我是通过
<asp:BoundField />我有这个属性。
ItemStyle-HorizontalAlign="Center"但我怎么可以访问此属性,如果在GridView动态关联
But how can i access this property if the gridview is associated dynamically
我希望你明白我的问题。
I hope u understand my problem
谢谢期待
推荐答案编辑:
尝试
foreach (GridViewRow row in GridView1.Rows) { foreach (TableCell cell in row.Cells) { cell.Attributes.CssStyle["text-align"] = "center"; } }更多推荐
围绕数据单元格中的网格视图
发布评论