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

RadGrid unwanted resizing

3 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 21 Mar 2012, 06:48 PM
Hi there, I have come across a problem with the Rad Grid shrinking in size when it's rebound, or when it's item command it hit.

I will explain where my grid sits, It is in a control which is situated in a RadWindow which contains a tab strip it is one of the page contols of one of the rad tabs.

The RadGrid is set up with the following code:


    <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="true" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnColumnCreated="RadGrid1_ColumnCreated" OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowSelection="true" ShowGroupPanel="true" OnItemCommand="RadGrid1_ItemCommand">
        <MasterTableView TableLayout="Fixed" Width="100%">     
            <Columns>
                <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                    <HeaderStyle Width="50px" />
                </telerik:GridClientSelectColumn>
                <telerik:GridButtonColumn DataTextFormatString="Download" UniqueName="DownloadLink" CommandName="Download"
                        runat="server" DataTextField="ID" ButtonType="LinkButton" >                    
                </telerik:GridButtonColumn>                                     
            </Columns>                        
        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="true" AllowDragToGroup="true" AllowColumnsReorder="true">
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />      
            <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
              ClipCellContentOnResize="false" EnableRealTimeResize="false" AllowResizeToFit="false" />                   
        </ClientSettings> 
    </telerik:RadGrid> 

When the page first loads the grid renders as desired, however once it has been updated or the Download command has been run the grid shrinks all columns so that the contents of the cells are spread over 3 lines.

Any ideas on how to stop this from happening?

Regards
Ryan

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 26 Mar 2012, 12:09 PM
Hi,

The problem you are observing is most probably caused by that you are changing the RadGrid structure before rendering and because the TableLayout is fixed RadGrid preserves its old value. You may need to call the Rebind() method of RadGrid or to change the structure earlier in the control life-cycle in order to prevent this behavior.

Could you post RadGrid event handlers and any code that is changing RadGrid structure?

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ryan
Top achievements
Rank 1
answered on 26 Mar 2012, 04:30 PM
Hi,

Thanks for the reply. The table layout is only set to fixed as this was an attempt to fix the re-sizing issue. 

After more investigating I am more of the belief that it is not the grid that is shrinking but the containing page. The page is in a RadTabStrip, and the grid view is in one of the pages which forms one of the tabs.

The structure of the RadTabStrip (The Grid is in ProcDetail_Attachments page)
<telerik:RadTabStrip ID="TabContainer" runat="server" SelectedIndex="0" MultiPageID="RadMultiPage">
                <Tabs>
                    <telerik:RadTab Text="Details" ID="Details" runat="server" ></telerik:RadTab>
                    <telerik:RadTab Text="Sections" ID="Sections" visible="false" runat="server"></telerik:RadTab>
                    <telerik:RadTab Text="Attachments" ID="Attachments" Visible="false" runat="server" ></telerik:RadTab>           
                </Tabs>      
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="RadMultiPage" runat="server" SelectedIndex="0" CssClass="StandardBackground">
                <telerik:RadPageView ID="DetailsPage" runat="server">
                    <uc1:ProcDetail_Details ID="ProcDetail_Details" runat="server" /> 
                </telerik:RadPageView>
                <telerik:RadPageView ID="SectionsPage" runat="server" visible="false">
                    <uc2:ProcDetail_Sections ID="ProcDetail_Sections" runat="server" />
                </telerik:RadPageView>
                <telerik:RadPageView ID="AttachmentsPage" runat="server" Visible="false" Width="1000px" >
                    <uc3:ProcDetail_Attachments ID="ProcDetail_Attachments" runat="server" />
                </telerik:RadPageView>
            </telerik:RadMultiPage>

Setting the width of the attachmentsPage RadPageView is a work around. Without this the page shrinks the grid, with the width set to 1000px the page is initially larger than it needs to be, when the delete button is then clicked the page shrinks be slightly larger than the grid but no longer shrinks the grid. Is there any way to stop the RadPageView resizing?
0
Andrey
Telerik team
answered on 28 Mar 2012, 03:29 PM
Hello,

I see that you set the Visible property of the RadPageView to false. How you are changing it to true? I think this is the point which brakes the layout. You could try set the PageView initially as Visible=true and then check whether the issue still replicates.

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or