在网格视图中对齐gridview单元格 [英] aligning gridview cells in grid view

查看:73
本文介绍了在网格视图中对齐gridview单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在gridview中对齐girdview单元.我正在使用gridview的项目模板.并在其中使用标签控制. gridview控件的什么属性可以帮助我们对齐单元格.

how to align girdview cells in gridview . i am using item template of gridview . and using lable control in it. what property of gridview controls helps us to align the cells.

推荐答案

使用
Use RowStyle[^] property
<asp:GridView ID="Gridview1" runat="server">
<RowStyle HorizontalAlign="Right" />
</asp:GridView>


如果要对齐特定的列,请尝试此


If you want to align particular column try this

<asp:boundfield headertext="Column1" datafield="Column1" headerstyle-horizontalalign="Right" footerstyle-horizontalalign="Right" itemstyle-horizontalalign="Right" xmlns:asp="#unknown" />


在您的问题中,您使用的是ItemTemplate,因此请使用CSS


In your question you are using ItemTemplate so use CSS

<asp:label id="Label1" runat="server" text="Label1" style="text-align:right;" xmlns:asp="#unknown"></asp:label>



thatraja提供的解决方案还可以.他是在网格中对齐itemtemplate单​​元格的另一种方法.
Hi,
Soluion that thatraja provided is ok. He is one more way how to align itemtemplate cell in grid.
...
    <headerstyle horizontalalign="Center" />
    <itemstyle horizontalalign="Center" />


他的"RowStyle"示例将使所有clls排成一行.
当然,您可以使用标准CSS属性来调整任何asp.net控件(元素)的样式.


His "RowStyle" example will align all clls in row.
Off course, you can use standard CSS properties to adjust styles of any asp.net control (element).


这篇关于在网格视图中对齐gridview单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆