Skip to main content

ASPxClientTabControlBase.AdjustSize Method

Modifies a tab page’s size in accordance with the content.

Declaration

AdjustSize(): void

Remarks

The AdjustSize method is useful to recalculate the tab page’s size after its content was changed on the client side.

Example

This sample demonstrates how to adjust the ASPxPageControl size after its active page’s content size (the ASPxGridview control is used inside as the ASPxPageControl) has been changed. For this purpose, a grid resizing is caught within the grid’s client EndCallback event, and the page control’s client AdjustSize method is called.

<dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" 
                    ClientInstanceName="ASPxPageControl1" TabPosition="Left">
    <TabPages>
        <dx:TabPage Text="Categories">
            <ContentCollection>
                <dx:ContentControl runat="server">
                    <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
                            DataSourceID="AccessDataSource1" KeyFieldName="CategoryID" Width="480px">
                            <ClientSideEvents EndCallback="function(s, e) {ASPxPageControl1.AdjustSize();}" />
                            <Columns>
                                <dx:GridViewCommandColumn ShowEditButton="True"/>
                                <dx:GridViewDataTextColumn FieldName="CategoryID" ReadOnly="True" >
                                    <EditFormSettings Visible="False" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="CategoryName" />
                                <dx:GridViewDataTextColumn FieldName="Description" />
                            </Columns>
                            <SettingsPager PageSize="5" />
                    </dx:ASPxGridView>
                </dx:ContentControl>
            </ContentCollection>
        </dx:TabPage>
        <dx:TabPage Text="Customers">
            <ContentCollection>
                <dx:ContentControl runat="server">
                    <dx:ASPxGridView ID="ASPxGridView2" runat="server"
                        AutoGenerateColumns="False" DataSourceID="AccessDataSource2" KeyFieldName="CustomerID"
                        Width="655px">
                        <ClientSideEvents EndCallback="function(s, e) {ASPxPageControl1.AdjustSize();}" />
                        <Columns>
                            <dx:GridViewCommandColumn ShowEditButton="True"/>
                            <dx:GridViewDataTextColumn FieldName="CustomerID" ReadOnly="True" />
                            <dx:GridViewDataTextColumn FieldName="CompanyName" />
                            <dx:GridViewDataTextColumn FieldName="ContactName" />
                            <dx:GridViewDataTextColumn FieldName="ContactTitle" />
                        </Columns>
                        <SettingsPager PageSize="5" />
                    </dx:ASPxGridView>
                </dx:ContentControl>
            </ContentCollection>
        </dx:TabPage>
    </TabPages>
</dx:ASPxPageControl>
See Also