开发者

Gridview's 'EmptyDataRowStyle' - unable to align center

I'm trying to align some text to the center of the page rather than the default left but can't seem to do this using the 'EmptyDataRowStyle' tag.

I have an EmptyDataText="No data" tag in my gridview which works. I have changed the style at the bottom of the gridview (as shown below) and the Font-Size="12px" Font-Names="Verdana" tags have worked but the align center tag does not work. Please help!

</asp:BoundField>
            </Columns>
            <RowStyle BackColor="#EFF3FB" />
            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyl开发者_Python百科e BackColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <EmptyDataRowStyle Font-Size="12px" Font-Names="Verdana" Text-align="center" />
        </asp:GridView>


I tried your code above and I'll get an exception since Text-align="center" is not valid, try setting the css class instead like below which I think is a better way to handle the problem:

CssClass="empty-row"
// If you like hardcoded styling try:
HorizontalAlign="Center"


First add to EmptyDataRowStyle tag the attribute CssClass="empty-row"
Then add the following selector to your css code: tr.empty-row td { text-align: center; }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜