AllowColumnResize in grid makes every column same width

1 posts, 0 answers
  1. Terje
    Terje avatar
    6 posts
    Member since:
    Oct 2013

    Posted 20 Sep Link to this post

    Hi!

    I've got a strange issue. I have a grid without any HeaderStyle-Width.

    If I set AllowColumnResize = false, every column of the grid is set to best size (button columns are narrow, columns with lots of text are wide). But obviously, I can't resize the columns.

    If I set AllowColumnResize = true, every column get the same width. Button columns get far too wide, columns with a lot of text too narrow.

    I'm using v 2016.3.914.45, I don't think it was a problem with the previous version.

    <telerik:RadGrid ID="RadGridVare" runat="server" DataSourceID="DsVare" AllowSorting="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" GroupPanelPosition="Top" CellSpacing="-1" GridLines="Both">
        <MasterTableView DataSourceID="DsVare" DataKeyNames="Vareid" AutoGenerateColumns="False" CommandItemDisplay="Top" NoMasterRecordsText="Ingen rader å vise">
            <CommandItemSettings AddNewRecordText="Legg til ny vare" ShowRefreshButton="False" CancelChangesText="Avbryt endringer" RefreshText="Oppdater" SaveChangesText="Lagre endringer"></CommandItemSettings>
            <Columns>
                <telerik:GridEditCommandColumn EditText="Rediger" UpdateText="Oppdater" CancelText="Avbryt" ButtonType="FontIconButton"></telerik:GridEditCommandColumn>
                <telerik:GridTemplateColumn UniqueName="thumb" AllowFiltering="false" AllowSorting="false" ReadOnly="true" InsertVisiblityMode="AlwaysHidden">
                    <ItemTemplate>
                        <telerik:RadBinaryImage ID="imgThumb" runat="server" CssClass="HandPointer" ImageUrl='<%# "~/ImageHandler.ashx?Thumb=true&Bildeid=0&Vareid=" + Eval("Vareid")%>' Width="110" />
                        <telerik:RadToolTip runat="server" ID="RadToolTip1" TargetControlID="imgThumb" ShowEvent="OnClick" Animation="Resize" Position="Center" RelativeTo="Element" ShowCallout="false" HideEvent="ManualClose">
                            <telerik:RadBinaryImage runat="server" ID="imgMedium" ImageUrl='<%# "~/ImageHandler.ashx?Thumb=false&Bildeid=0&Vareid=" + Eval("Vareid")%>' AutoAdjustImageControlSize="false" />
                        </telerik:RadToolTip>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="Vareid" FilterControlAltText="Filter Vareid column" HeaderText="Vareid" UniqueName="Vareid" DataType="System.Int32" SortExpression="Vareid" ReadOnly="true"></telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataField="Kategoriid" FilterControlAltText="Filter Kategoriid column" HeaderText="Kategori" SortExpression="Kategoriid" UniqueName="Kategoriid" DataSourceID="DsKategori" ListTextField="Navn" ListValueField="Kategoriid"></telerik:GridDropDownColumn>
                <telerik:GridDropDownColumn DataField="Lagerid" FilterControlAltText="Filter Lagerid column" HeaderText="Lager" SortExpression="Lagerid" UniqueName="Lagerid"  DataSourceID="DsLager" ListTextField="Navn" ListValueField="Lagerid"></telerik:GridDropDownColumn>
                <telerik:GridBoundColumn DataField="Lokasjon" FilterControlAltText="Filter Lokasjon column" HeaderText="Lokasjon" SortExpression="Lokasjon" UniqueName="Lokasjon" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Navn" FilterControlAltText="Filter Navn column" HeaderText="Navn" SortExpression="Navn" UniqueName="Navn" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Elnummer" FilterControlAltText="Filter Elnummer column" HeaderText="Elnummer" SortExpression="Elnummer" UniqueName="Elnummer" MaxLength="20"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Merkeytelse" FilterControlAltText="Filter Merkeytelse column" HeaderText="Merkeytelse" SortExpression="Merkeytelse" UniqueName="Merkeytelse" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="MerkespHS" FilterControlAltText="Filter MerkespHS column" HeaderText="MerkespHS" SortExpression="MerkespHS" UniqueName="MerkespHS" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="MerkespLS" FilterControlAltText="Filter MerkespLS column" HeaderText="MerkespLS" SortExpression="MerkespLS" UniqueName="MerkespLS" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Typebetegnelse" FilterControlAltText="Filter Typebetegnelse column" HeaderText="Typebetegnelse" SortExpression="Typebetegnelse" UniqueName="Typebetegnelse" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Merkestrøm" FilterControlAltText="Filter Merkestrøm column" HeaderText="Merkestrøm" SortExpression="Merkestrøm" UniqueName="Merkestrøm" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Fabrikat" FilterControlAltText="Filter Fabrikat column" HeaderText="Fabrikat" SortExpression="Fabrikat" UniqueName="Fabrikat" MaxLength="50"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Merknad" FilterControlAltText="Filter Merknad column" HeaderText="Merknad" SortExpression="Merknad" UniqueName="Merknad" MaxLength="200"></telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataField="Levert" FilterControlAltText="Filter Levert column" HeaderText="Levert" SortExpression="Levert" UniqueName="Levert" DataSourceID="DsLevertStatus" ListTextField="Navn" ListValueField="LevertStatusid"></telerik:GridDropDownColumn>
                <telerik:GridBoundColumn DataField="LevertTekst" FilterControlAltText="Filter LevertTekst column" HeaderText="LevertTekst" SortExpression="LevertTekst" UniqueName="LevertTekst" MaxLength="100"></telerik:GridBoundColumn>
                <telerik:GridButtonColumn ButtonType="FontIconButton" CommandName="Delete"></telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="true" />
            <Resizing AllowColumnResize="true" />
        </ClientSettings>
        <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
    </telerik:RadGrid>

Back to Top