围绕数据单元格中的网格视图

编程入门 行业动态 更新时间:2024-10-10 23:15:33
本文介绍了围绕数据单元格中的网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个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"; } }

更多推荐

围绕数据单元格中的网格视图

本文发布于:2023-11-23 04:15:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620051.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网格   视图   单元格   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!