当前位置:编程学习 > C#/ASP.NET >>

GridView中用DIV加滚动条,怎样在选中一条记录后让滚动条定位在选中的记录附近?

<div style="overflow-y: scroll ;  width: 794px; height: 200px" id="onlinediv" >
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                        BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3"
                        CellSpacing="1" DataSourceID="SqlDataSource1" GridLines="None" PageSize="5" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="775px" DataKeyNames="ID">
                        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" SelectText="选择">
                                <ItemStyle Width="28px" />
                            </asp:CommandField>
                            <asp:BoundField DataField="appName"  HeaderText="申请名称" SortExpression="appName" >
                                <ItemStyle Width="180px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="runLicenceID" HeaderText="经营许可证号" SortExpression="runLicenceID" >
                                <ItemStyle Width="90px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="addr" HeaderText="地址" SortExpression="addr">
                                <ItemStyle Width="180px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="EconomyType" HeaderText="经济类型" SortExpression="EconomyType">
                                <ItemStyle Width="70px" />
                            </asp:BoundField>
                            
                            <asp:BoundField DataField="ZZDJ" HeaderText="资质等级" SortExpression="ZZDJ">
                                <ItemStyle Width="70px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="InNet" HeaderText="运营中" SortExpression="InNet" >
                                <ItemStyle Width="50px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
                        </Columns>
                        <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                        <SelectedRowStyle BackColor="#CADFFC" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                        <HeaderStyle BackColor="#6A91D4" Font-Bold="True" ForeColor="#E7E7FF" />
                    </asp:GridView>
                    </div>
                      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:keyunConnectionString %>"
                    ProviderName="System.Data.SqlClient">
                </asp:SqlDataSource>

由于记录过多 选择后滚动条就回到最顶端 
我使用VS2005 为什么div中没有onscroll属性 而且其他事件也不执行 
--------------------编程问答-------------------- div中加上runat="server"试试 --------------------编程问答-------------------- 帮忙顶顶!~~~~~~~~~~~~~~~ --------------------编程问答-------------------- 这个问题我也想知道,,,, --------------------编程问答-------------------- 加上层吧,定义下高度就行~ --------------------编程问答-------------------- 我也遇到了这个问题,不知道楼主是怎么解决的? --------------------编程问答-------------------- <%@ Page MaintainScrollPositionOnPostback="true"
设置一下这个属性,是指控件操作时 回传后还保持原来的位置,可以避免页面每次刷新都前置 。应该可以解决你的效果 --------------------编程问答-------------------- 观望高手解决 学习 --------------------编程问答-------------------- 被同样的问题困扰着的人 求高手指教 --------------------编程问答-------------------- 同样的问题,急需解决,望高手现身! --------------------编程问答-------------------- 我也是同样的问题,求解!!!! --------------------编程问答-------------------- gridview怎么会出现滚动。一般分页了
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,