Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
755
right align column header text
posted

I populate a grid with strings and numerical data. I want the columns containing numerical data to be right aligned.

Therefor I asign the cssclass "ar" to the CssClass property of my BoundDataField object and declare in my css file:

tbody.igg_Item tr td.ar
{
  text-align : right;
}

no problem all my numerical data is right aligned.

However how can I right align the corresponding header text?

The Header object does not contain a CssClass property?

Parents
  • 28464
    posted

    Hello,

    Currently I think there are two options - directly modify .igg_HeaderCaption th for grid header and set text-align to right, but this will affect all headers in the grid

    .igg_HeaderCaption {ig_datagrid.css (line 21)
    overflow:hidden;
    padding-bottom:4px;
    padding-left:8px;
    padding-top:4px;
    text-align:left;
    }

    The other option I see is by using templates, e.g.

                <ig:TemplateDataField Key="ProductName">
                    <HeaderTemplate>
                        <div style="text-align: right !important;">
                            Right
                        </div>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%# Eval("ProductName") %>
                    </ItemTemplate>
                </ig:TemplateDataField>

    CssClass for header is a good idea, maybe we will implement it future versions of the product.

Reply Children