GridView中左侧的第一列和右侧的剩余列

时间:2012-02-10 06:20:54

标签: asp.net css

如何在Gridview中向左和剩下的列中显示第一列?

1 个答案:

答案 0 :(得分:6)

尝试使用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>
希望它有所帮助!!!