Setting column width using CSS

2 posts, 0 answers
  1. jmillar
    jmillar avatar
    35 posts
    Member since:
    Oct 2006

    Posted 25 Feb 2016 Link to this post

    Hi there;

    I have a grid with column definitions similar to the following:

    <telerik:GridNumericColumn UniqueName="R1" Visible="true" ReadOnly="false" HeaderText="Q1" DataField="R1" DataFormatString="{0:0}%" HeaderStyle-CssClass="EntryColumn" ItemStyle-CssClass="EntryColumn" />

    The EntryColumn class just has a simple width:30px definition, with nothing else.

    The grid respects the column width until I add the Command Bar display - with that on, it reverts to just showing the columns in the default width.  I can fix it using ItemStyle-Width, but I'd rather use a class definition as I have several of these types of grids scattered throughout the app.

    Anybody know what I'm doing wrong?



  2. Pavlina
    Pavlina avatar
    6162 posts

    Posted 01 Mar 2016 Link to this post


    Below is a sample page I tested locally and setting column width is working as expected. Try it on your end and let me know if it helps. Also make sure that MasterTableView TableLayout is set to Fixed:
                width: 30px;

    <telerik:RadGrid ID="grd" runat="server" AutoGenerateColumns="false" AllowPaging="True"
                OnNeedDataSource="grd_NeedDataSource" PageSize="10">
                <MasterTableView AllowFilteringByColumn="True" CommandItemDisplay="Top" AllowSorting="True"
                    CanRetrieveAllData="False" EnableColumnsViewState="True" EnableViewState="True" TableLayout="Fixed">
                    <PagerStyle AlwaysVisible="true" />
                        <telerik:GridNumericColumn UniqueName="DisplayOrder" Visible="true" ReadOnly="false" HeaderText="Q1" DataField="DisplayOrder"
                            DataFormatString="{0:0}%" HeaderStyle-CssClass="EntryColumn" ItemStyle-CssClass="EntryColumn" />
                        <telerik:GridBoundColumn DataField="Status" HeaderText="Status">

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top