how to avoid WebGrid Resize on postback

7 replies. Last post: July 27, 2011 10:38 PM by Riendy Setiadi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Dilshad KMember

I hreby attached an example that shows the webgrid inside a tab control, that grows in height everytime, when we click the button in tab 2 and comes back to tab 1.

Steps to create the issue

1. Check the height of the webgrid in tab 1.

2. go to tab 2 and click the button. this makes a page postback.

3. come to tab 1 and check the webgrid height.

4. ensure the height will change once we click the refresh image in webgrid.

the standard height has been defined in the webgrid.

Still why it is growing heightwise, if we click the button in tab 2?

Please give a solution.

 I could not attach the project. so I have given the code and the xml file below.

   <ISWebDesktop:WebTab ID="WebTab1" runat="server" Height="343px" 
    Width="680px">
        <TabPages>
          <ISWebDesktop:WebTabItem Text="Tab 1">
                <PageTemplate>
                    <ISWebGrid:WebGrid ID="dgSegments" runat="server" Height="200px" Width="500px"
                        DefaultStyleMode="Win7" 
                        DataSourceID="XmlDataSource2">
                        <LayoutSettings AllowExport="Yes" AllowFilter="Yes" GridLineColor="236, 233, 216"
                            RowHeaders="No" AutoFilterSuggestion="true" ShowFilterStatus="true" PagingExportMode="ExportAllData"
                            AllowSorting="Yes" RowHeightDefault="-1px">
                            <FrameStyle BackColor="White" BorderColor="#FFE0C0" BorderStyle="Solid" BorderWidth="1px"
                                Height="200px" Width="500px">
                            </FrameStyle>
                            <AlternatingRowStyle BackColor="#ffe0d9" CustomRules="text-overflow: ellipsis; overflow-x: hidden"
                                Font-Names="Verdana" Font-Size="8pt" />
                            <FocusCellStyle BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px" />
                            <RowStyle BackColor="White" CustomRules="text-overflow: ellipsis; overflow-x: hidden ; overflow-y: hidden"
                                Font-Names="Verdana" Font-Size="8pt" />
                            <SelectedRowStyle BackColor="LightSteelBlue" />
                            <HeaderStyle BackColor="#D32730" BorderColor="#CC9966" BorderWidth="1px" Font-Names="Verdana"
                                Font-Size="8pt" ForeColor="White" Font-Bold="true" Height="20px" Wrap="False"
                                CustomRules="border-right: solid 1px #F8EDD7; border-bottom:  solid 1px #F8EDD7" />
                            <FooterStyle BackColor="#D32730" ForeColor="white" />
                            <NewRowStyle BackColor="White" Font-Names="Verdana" Font-Size="8pt" ForeColor="DarkGray">
                            </NewRowStyle>
                            <StatusBarStyle BackColor="#ffe0d9" BorderColor="#D32730" BorderStyle="Solid" BorderWidth="1px"
                                Font-Names="Verdana" Font-Size="8pt" ForeColor="Black">
                                <Padding Bottom="1px" Left="1px" Right="1px" Top="1px" />
                            </StatusBarStyle>
                            <StatusBarCommandStyle>
                                <Normal>
                                    <Padding Bottom="1px" Left="1px" Right="1px" Top="1px" />
                                </Normal>
                                <Over BackColor="CornflowerBlue" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px">
                                </Over>
                                <Active BackColor="RoyalBlue" BaseStyle="Over">
                                </Active>
                            </StatusBarCommandStyle>
                            <EditTextboxStyle BorderStyle="None" BorderWidth="0px" Font-Names="Verdana" Font-Size="8pt">
                            </EditTextboxStyle>
                        </LayoutSettings>
                        <RootTable Caption="SegmentDetails" DataKeyField="name">
                            <Columns>
                                <ISWebGrid:WebGridColumn Caption="Name" DataMember="name" FilterEditType="TextBox"
                                    EditType="NoEdit" Name="isdSegment" Width="150px" AllowMultiLine="True">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Description" DataMember="description" FilterEditType="TextBox"
                                    EditType="NoEdit" Name="isdDescriptionr" Width="200px" AllowMultiLine="True">
                                </ISWebGrid:WebGridColumn>
                            </Columns>
                        </RootTable>
                    </ISWebGrid:WebGrid>
                    <asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="~/Company.xml">
                    </asp:XmlDataSource>
                </PageTemplate>
            </ISWebDesktop:WebTabItem>
            <ISWebDesktop:WebTabItem Name="tab2" Text="tab2">
                <PageTemplate>
                    <asp:Button ID="Button2" runat="server" Text="Button" />
                </PageTemplate>
            </ISWebDesktop:WebTabItem>
        </TabPages>

<FrameStyle Overflow="Hidden" OverflowY="Hidden" OverflowX="Hidden"></FrameStyle>

<TabItemStyle>
<Normal Cursor="Hand" BackColor="Gainsboro" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma" Font-Size="8pt" Font-Underline="False" Height="100%" Width="100%">
<Padding Top="2px" Left="10px" Right="10px" Bottom="0px"></Padding>
</Normal>

<Over BaseStyle="Normal" BackColor="WhiteSmoke"></Over>

<Active GradientType="Vertical" BackColor2="245, 245, 245" BaseStyle="Normal" BackColor="White" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px"></Active>
</TabItemStyle>

<ContainerStyle Overflow="Auto" OverflowY="Auto" OverflowX="Auto" BackColor="WhiteSmoke" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px" Height="100%" Width="100%">
<Padding Top="5px" Left="5px" Right="5px" Bottom="5px"></Padding>
</ContainerStyle>

<RoundCornerSettings TopBorderColor="230, 139, 44" FillerBorderColor="255, 199, 60"></RoundCornerSettings>

<DisabledStyle ForeColor="Gray"></DisabledStyle>
    </ISWebDesktop:WebTab>

I have the xml file like this.

 

<?xml version="1.0" encoding="utf-8" ?><Company><CompanyCode name="MMI" description="MMI Company">

MMI

</CompanyCode><

CompanyCode name="SRC" description="Sirocco Company">

SRC

</CompanyCode><

CompanyCode name="MMIM" description="Maldives Company">

MMIM

</CompanyCode>

</Company>

All times are GMT -5. The time now is 9:55 PM.
Previous Next