Gridview的标题列未对齐

时间:2016-12-07 15:39:08

标签: css asp.net gridview

我的gridview的最后一个标题栏由于某种原因没有对齐,我不确定为什么,有什么帮助吗?

<asp:GridView ID="gvStudents" runat="server" AutoGenerateColumns="False" 
    DataSourceID="SQLGetStudents" Width="100%" CssClass="table table-striped table-hover">
    <alternatingrowstyle backcolor="#d0e6f4" forecolor="#545454"/>
    <Columns>
        <asp:BoundField DataField="PERSON_CODE" HeaderText="Student ID" 
            SortExpression="PERSON_CODE" >
        <HeaderStyle HorizontalAlign="Center" />
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField DataField="STUDENTNAME" HeaderText="Student Name" 
            SortExpression="STUDENTNAME" >
        <HeaderStyle Font-Bold="True" Font-Size="Larger" />
        <ItemStyle Font-Bold="True" Font-Size="Larger" />
        </asp:BoundField>
        <asp:TemplateField HeaderStyle-HorizontalAlign="Center">
            <HeaderTemplate>
                    <asp:Label runat="server" >Add</asp:Label>
                    <br />
                    <asp:CheckBox ID="chkAll" runat="server" onclick = "checkAll(this);"  />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:CheckBox ID="chkAdd" runat="server" Checked="True" onclick = "Check_Click(this)"/>
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center" />
            <ItemStyle HorizontalAlign="Center" />

        </asp:TemplateField>
    </Columns>
</asp:GridView>

我的gridview的特定部分似乎无法正常工作:

<asp:TemplateField HeaderStyle-HorizontalAlign="Center">
            <HeaderTemplate>
                    <asp:Label runat="server" >Add</asp:Label>
                    <br />
                    <asp:CheckBox ID="chkAll" runat="server" onclick = "checkAll(this);"  />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:CheckBox ID="chkAdd" runat="server" Checked="True" onclick = "Check_Click(this)"/>
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center" />
            <ItemStyle HorizontalAlign="Center" />

        </asp:TemplateField>

但我认为id会添加所有gridview以防万一我搞砸了其他地方

列显示如下: The column shows up like this:

0 个答案:

没有答案