This is a migrated thread and some comments may be shown as answers.

[Solved] Cannot get a column size to absolutely, positively, be fixed size...

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Y
Top achievements
Rank 2
Steve Y asked on 03 Jul 2009, 06:36 PM
I have a grid where I allow column resizing by default, have fixed widths for some columns, specifically disallow column resizing for those columns, yet when other (resizable) columns are resized, those fixed columns change size too. How can I get some of my columns to never resize...!

Here's an example of my markup. Specifically, notice my two command columns which happen to be the first and last columns in the grid - the GridEditCommandColumn and the GridButtonColumn which both have Resizable="false". It is especially a problem for the last column in the grid, the GridButtonColumn. The Resizable="false" prevents the right column border from being moved, but if the one to the left, which belongs to a column which can be resized is moved (LoanBalance), it will  change the size of the button column.

Is this a bug?
Thanks, Steve

<telerik:RadGrid ID="rgLiens" runat="server" EnableEmbeddedSkins="false" Skin="RealMax" 
        OnNeedDataSource="rgLiens_NeedDataSource" OnItemCreated="rgLiens_ItemCreated"  
        ondeletecommand="rgLiens_DeleteCommand" oninsertcommand="rgLiens_InsertCommand"  
        onupdatecommand="rgLiens_UpdateCommand" OnPreRender="rgLiens_PreRender" OnItemDataBound="rgLiens_ItemDataBound" 
        OnRowDrop="rgLiens_RowDrop" GridLines="None" ShowFooter="True" > 
    <ClientSettings EnableRowHoverStyle="true" AllowRowsDragDrop="true"
        <ClientEvents OnRowMouseOut="rowMouseOut" OnRowMouseOver="rowMouseOver" OnPopUpShowing="PopUpCentered" /> 
        <Selecting AllowRowSelect="true" /> 
        <Resizing AllowColumnResize="True" /> 
    </ClientSettings> 
        <FilterMenu EnableTheming="True"
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    </FilterMenu> 
    <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" EditMode="EditForms" TableLayout="auto" 
            DataKeyNames="LienId,LienIndex,PropertyId">         
      <NoRecordsTemplate><div style="margin:6px">No liens recorded for this property</div></NoRecordsTemplate>        
      <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="false" /> 
      <ItemStyle CssClass="RowMouseOut" /> 
      <AlternatingItemStyle CssClass="RowMouseOut" /> 
      <RowIndicatorColumn HeaderStyle-Width="20px" /> 
      <ExpandCollapseColumn HeaderStyle-Width="20px" /> 
       
      <Columns> 
        <telerik:GridEditCommandColumn EditImageUrl="~/Images/Buttons/edit.gif" ButtonType="ImageButton" Resizable="false" > 
            <HeaderStyle Width="24px" /> 
            <ItemStyle CssClass="CommandColumn" /> 
        </telerik:GridEditCommandColumn> 
        <Telerik:GridBoundColumn DataField="LienIndex" DataType="System.Int16" ReadOnly="true"
            <HeaderStyle Width="20px" HorizontalAlign="Center" /> 
        </Telerik:GridBoundColumn> 
        <telerik:GridNumericColumn DataField="LoanAmount" DataType="System.Decimal" NumericType="Currency"   
            HeaderText="Loan Amount" SortExpression="LoanAmount" UniqueName="LoanAmount" Aggregate="Sum" FooterAggregateFormatString="{0:C}"
            <HeaderStyle Width="90px" HorizontalAlign="Center" /> 
            <ItemStyle HorizontalAlign="Right" /> 
            <FooterStyle HorizontalAlign="Right" /> 
        </telerik:GridNumericColumn> 
        <telerik:GridNumericColumn DataField="InterestRate" DataType="System.Decimal" NumericType="Percent"  
            HeaderText="Interest Rate" SortExpression="InterestRate" DataFormatString="{0}%" 
            UniqueName="InterestRate"
            <HeaderStyle Width="90px" HorizontalAlign="Center" /> 
            <ItemStyle HorizontalAlign="Right" /> 
            <FooterStyle HorizontalAlign="Right" /> 
        </telerik:GridNumericColumn> 
        <telerik:GridNumericColumn DataField="MonthlyPayment" DataType="System.Decimal" NumericType="Currency"  
            HeaderText="Payment" SortExpression="MonthlyPayment" UniqueName="MonthlyPayment" Aggregate="Sum" FooterAggregateFormatString="{0:C}"
            <HeaderStyle Width="90px" HorizontalAlign="Center" /> 
            <ItemStyle HorizontalAlign="Right" /> 
            <FooterStyle HorizontalAlign="Right" /> 
        </telerik:GridNumericColumn> 
        <telerik:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:$#,##0.00;($#,##0.00);#}" DataField="Arrears" DataType="System.Decimal" NumericType="Currency"  
            HeaderText="Arrears" SortExpression="Arrears" UniqueName="Arrears" ItemStyle-ForeColor="Red"
            <HeaderStyle Width="90px" HorizontalAlign="Center" /> 
            <ItemStyle HorizontalAlign="Right" ForeColor="Red" /> 
            <FooterStyle HorizontalAlign="Right" ForeColor="Red" /> 
        </telerik:GridNumericColumn> 
        <telerik:GridBoundColumn DataField="rtp_Lender.Name" DataType="System.String"  
            HeaderText="Lender" SortExpression="rtp_Lenders.Name" UniqueName="LenderName"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="LoanNumber" DataType="System.String"  
            HeaderText="Loan Number" SortExpression="LoanNumber" UniqueName="LoanNumber"
        </telerik:GridBoundColumn> 
        <telerik:GridDateTimeColumn DataField="LoanDate" DataType="System.DateTime"  
            HeaderText="Loan Date" SortExpression="LoanDate" UniqueName="LoanDate"  
            DataFormatString="{0:MM/dd/yyyy}"
        </telerik:GridDateTimeColumn> 
        <telerik:GridBoundColumn DataField="rtp_LoanType.Name" DataType="System.String" HeaderText="Loan Type" 
            SortExpression="LoanType" UniqueName="LoanType"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Term" DataType="System.Int32"  
            HeaderText="Term" SortExpression="Term" UniqueName="Term"
        </telerik:GridBoundColumn> 
        <telerik:GridNumericColumn DataField="LoanBalance" DataType="System.Decimal" NumericType="Currency"  
            HeaderText="Loan Balance" SortExpression="LoanBalance" UniqueName="LoanBalance" Aggregate="Sum" FooterAggregateFormatString="{0:C}"
            <HeaderStyle Width="90px" HorizontalAlign="Center" /> 
            <ItemStyle HorizontalAlign="Right" /> 
            <FooterStyle HorizontalAlign="Right" /> 
        </telerik:GridNumericColumn> 
        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Resizable="false"    
            ConfirmDialogType="RadWindow" ConfirmText="Are you sure?" ConfirmTitle="Delete Lien?"  
            ImageUrl="~/Images/Buttons/delete.gif" Text="Delete" UniqueName="DeleteColumn"
            <HeaderStyle Width="24px" /> 
            <ItemStyle CssClass="CommandColumn" /> 
        </telerik:GridButtonColumn> 
    </Columns> 
 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 07 Jul 2009, 01:24 PM
Hello Steve,

Could you try set TableLayout to "Fixed"? Thus the table will not expand its width in order to fill RadGrid's width. Let me know how it goes.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Steve Y
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or