当前位置: 代码迷 >> ASP.NET >> asp.net2008 ajax上 自动动态设置网页大小
  详细解决方案

asp.net2008 ajax上 自动动态设置网页大小

热度:7248   发布时间:2013-02-25 00:00:00.0
asp.net2008 ajax下 自动动态设置网页大小
HTML code
                        [color=#3366FF]<iframe id="treeinfo"  name="resultFrame" marginwidth="0" marginheight="0" src="about:blank"  frameborder="0" width="100%" scrolling="no"                           onload="this.style.height=treeinfo.document.body.scrollHeight"  height="100%">                        </iframe>[/color]

HTML code
                       <body style="background-color: #E8F5FE;" >    <form id="form1" runat="server">    <div id="listDiv" runat="server">    <asp:ScriptManager ID="ScriptManager1" runat="server">    </asp:ScriptManager>    <asp:UpdatePanel ID="UpdatePanel1" runat="server">    <ContentTemplate>    <asp:SqlDataSource ID="SqlDataSource1" runat="server"             ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"             .....省略掉        </asp:SqlDataSource>                  <asp:ListView ID="ListView1" runat="server" DataKeyNames="N_UNITID"             DataSourceID="SqlDataSource1" >              .....省略掉        </asp:ListView>                    <[color=#FF0000]asp:DataPager[/color] ID="DataPager2" runat="server" PagedControlID="ListView1"                         PageSize="5"  onprerender="DataPager2_PreRender" >                        <Fields>                               <asp:NextPreviousPagerField  ButtonType="Link" ShowFirstPageButton="True" ShowPreviousPageButton="True" ShowLastPageButton="True"  RenderDisabledButtonsAsLabels="False" />                            <asp:NumericPagerField ButtonCount="10"  />                                                    </Fields>                    </[color=#FF0000]asp:DataPager[/color]>    </ContentTemplate>    </asp:UpdatePanel>          </div>      </form></body>


JScript code
[color=#800080]parent.document.getElementById('treeinfo').style.height = parent.treeinfo.document.body.scrollHeight;[/color]



如上,黑色部分是经过查询后加在蓝色部分的框架中的.框架的高度是根据被加载页面而改变大小的.现在问题是:
因为采用了ajax无刷新模式.当点DataPager中分页导航条时,不同页的ListView中的表格高度可能不一样.这样就会造成在网页中显示不全,不能网页动态适应ListView高度变化而进行高度调整.
当然,我在代码中加入手动控制按钮,在按钮中加入紫色部分代码,是可以调整高度让网页显示完全.
问题是,我如何让系统自动根据用户点DataPager中页导航条市,执行紫色部分代码.让网页自动调整高度?
注:不用ajax无刷新模式,系统是自动能调整高度的

------解决方案--------------------------------------------------------
学习`关注`UP
------解决方案--------------------------------------------------------
算了 我也跟一把把
------解决方案--------------------------------------------------------
顶个
------解决方案--------------------------------------------------------
顶一个。
  相关解决方案