【问题标题】:First column to left and remaining columns to right in GridViewGridView 中的第一列在左侧,其余列在右侧
【发布时间】:2012-02-10 06:20:53
【问题描述】:

如何在 Gridview 的左侧显示第一列,在右侧显示剩余的列?

【问题讨论】:

  • 如何将数据绑定到GridView? AutoGenerateColumns="False" 还是“True”?如果是,您可以在 sql 脚本中管理列顺序。如果您使用 AutoGenerateColumns="False",您可以根据需要安排绑定数据列的顺序。
  • 哦对不起..我误会了..你说的是文本对齐。

标签: asp.net css


【解决方案1】:

使用 css 试试这个

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .gridview tr td
        {
            text-align: right;
        }
        .gridview tr td:first-child
        {
            text-align: left;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" CssClass="gridview" runat="server">
        </asp:GridView>
    </div>
    </form>
</body>
</html>

希望对你有帮助!!!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-02
    • 2021-07-13
    • 2020-02-12
    • 1970-01-01
    • 1970-01-01
    • 2015-06-27
    • 1970-01-01
    相关资源
    最近更新 更多