溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

ASP.NET如何實(shí)現(xiàn)固定標(biāo)題列與欄位

發(fā)布時(shí)間:2021-10-13 09:46:26 來源:億速云 閱讀:135 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要為大家展示了“ASP.NET如何實(shí)現(xiàn)固定標(biāo)題列與欄位”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“ASP.NET如何實(shí)現(xiàn)固定標(biāo)題列與欄位”這篇文章吧。

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" />

//以上的文件都可以直接到網(wǎng)上下載的

    <script type="text/javascript">

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

        function gridviewScroll() {

//  因?yàn)槲业腉RIDVIEW 要放在一個(gè)DIV中所以要獲得對應(yīng)的高度和寬度,一般直接數(shù)字設(shè)置就好了

            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//控制頭幾列不動(dòng)
            });
        }

復(fù)制代碼 代碼如下:


<div id="divservic" >

                            <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>

以上是“ASP.NET如何實(shí)現(xiàn)固定標(biāo)題列與欄位”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI