views:

200

answers:

1

Hi,

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" />
            <AlternatingRowStyle BackColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <EmptyDataRowStyle Font-Size="12px" Font-Names="Verdana" Text-align="center" />
        </asp:GridView>
A: 

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"
orjan