• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ASP.NET 固定标题列与栏位的具体实现

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

APSX 页面代码: JS

复制代码 代码如下:
      
<script src="../Js/jquery-1.8.3.min.js" type="text/javascript"></script>    -
    <script src="../Js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>

    <script src="../Js/gridviewScroll.min.js" type="text/javascript"></script>

    <link href="../CSS/GridviewScroll.css" rel="stylesheet" type="text/css" />

//以上的文件都可以直接到网上下载的

    <script type="text/javascript">

        $(document).ready(function() {
            gridviewScroll();
        });

        function gridviewScroll() {

//  因为我的GRIDVIEW 要放在一个DIV中所以要获得对应的高度和宽度,一般直接数字设置就好了

            var gridWidth = $("#divservic").width();
            var gridHeight = $("#divservic").height();

            var headerHeight = $("#divHeader").height();

            gridHeight = gridHeight - headerHeight;

            $('#<%=GridView2.ClientID%>').gridviewScroll({
            width: gridWidth,//宽度 一定不能用100%  可直接写死
            height: gridHeight,//高度  可以直接写死
            freezesize:4//控制头几列不动
            });
        }


复制代码 代码如下:

<div id="divservic" style="width: 100%;margin-bottom: 2px; height:220px;">

                            <asp:GridView ID="GridView2" runat="server" CellPadding="4" ForeColor="#333333" Width="100%"
                                BorderColor="#D1DDAA" AllowPaging="True" DataKeyNames="InstallationID"
                                OnPageIndexChanging="GridView2_PageIndexChanging"
                                onrowdatabound="GridView2_RowDataBound"
                                onrowdeleting="GridView2_RowDeleting" AutoGenerateColumns="False"
                                AllowSorting="True" onsorting="GridView2_Sorting">
                                <RowStyle CssClass="GridviewScrollItem"  />>-------------------------------------------------------------这里的样式要添加
                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <PagerStyle CssClass="GridviewScrollPager"  />-------------------------------------------------------------这里的样式要添加
                                <SelectedRowStyle BackColor="#C5BBAF"  />
                                <HeaderStyle CssClass="GridviewScrollHeader" />-------------------------------------------------------------这里的样式要添加
                                <EditRowStyle BackColor="#7C6F57" />
                                <AlternatingRowStyle BackColor="White" BorderColor="#D1DDAA" />
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="ckbitem" runat="server" />
                                        </ItemTemplate>

                                    </asp:TemplateField>
                                 <asp:BoundField DataField="InstallationID" HeaderText="InstallationID"
                                        SortExpression="InstallationID" />
                                    <asp:BoundField DataField="Completed" HeaderText="Completed" />
                                    <asp:BoundField DataField="Tid" HeaderText="Tid" />
                                    <asp:BoundField DataField="Mid" HeaderText="Mid" />
                                    <asp:BoundField DataField="Bank" HeaderText="Bank" />
                                    <asp:BoundField DataField="Model" HeaderText="Model" />
                                    <asp:BoundField DataField="Barcode" HeaderText="Barcode" />
                                    <asp:BoundField DataField="DateReq" HeaderText="DateReq"
                                        SortExpression="DateReq" />

                                </Columns>
                            </asp:GridView>
                         </div>


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ADO.Net对oracle数据库操作的实例代码发布时间:2022-02-05
下一篇:
ASP.Net缓存总结及分析 分享发布时间:2022-02-05
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap