2019年10月20日 星期日

GridView使用自带分页功能时分页方式及样式PagerStyle

https://www.bbsmax.com/A/kPzO8le1Jx/

<%@ Page Title="" Language="C#" MasterPageFile="~/mnd_museum.master" AutoEventWireup="true" CodeFile="op_mgmt.aspx.cs" Inherits="op_mgmt" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>清冊資料管理</title>
    <link rel="stylesheet" href="css/bootstrap3.3.7.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="icon" type="image/png" href="img/foricon.png">
    <style>
        .mgmttable{
            border:0px;
        }
        .mgmttable tr:first-child td{
            border:0px;
            padding-bottom:10px;

        }
        .bubufxPagerCss table {
            text-align: center;
            margin: auto;
        }

            .bubufxPagerCss table td {
                border: 0px;
                padding: 5px;
            }

        /*.bubufxPagerCss td {
            border-left: #ffffff 3px solid;
            border-right: #ffffff 3px solid;
            border-bottom: #ffffff 3px solid;
        }*/
        
        .bubufxPagerCss a {
            color: #231815;
            text-decoration: none;
            padding: 3px 6px 3px 6px;
            margin: 0 0 0 4px;
            text-align: center;
            border: 1px solid #ac1f24;
        }

        .bubufxPagerCss span {
            color: #fefefe;
            background-color: #ac1f24;
            padding: 3px 6px 3px 6px;
            margin: 0 0 0 4px;
            text-align: center;
            font-weight: bold;
            border: 1px solid #ac1f24;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="right_col">
        <h1 class="pageTitle">清冊資料管理</h1>
        <div class="mgLeft">
            <form id="thisform">
                <table class="leftTable">
                    <asp:Panel ID="Panel1" runat="server" Visible="false">
                        <tr>
                            <th>管理單位:</th>
                            <td>
                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            </td>
                            <td></td>
                            <td></td>
                        </tr>
                    </asp:Panel>
                    <tr>
                        <th>典藏號:</th>
                        <td>
                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        </td>
                        <th>名稱:</th>
                        <td>
                            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                </table>
                <div class="btnArea">
                    <asp:Button ID="Button1" runat="server" CssClass="btnBlue btclick" Text="查詢" OnClick="Button1_Click" />

                    <asp:Button ID="Button2" runat="server" CssClass="btnBlue btpick_brown" Text="列印" />

                </div>

            </form>

            <div class="separation"></div>
            <div class="formBox">
                <asp:Panel ID="Panel2" runat="server">
                    <nav aria-label="Page navigation" class="navpagination noPrint">
                       <%-- <ul class="pagination">
                            <li class="page-item">
                                <a class="page-link" href="#" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                    <span class="sr-only">Previous</span>
                                </a>
                            </li>
                            <li class="page-item active"><a class="page-link" href="#">1</a></li>
                            <li class="page-item"><a class="page-link" href="#">2</a></li>
                            <li class="page-item"><a class="page-link" href="#">3</a></li>
                            <li class="page-item">
                                <a class="page-link" href="#" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                    <span class="sr-only">Next</span>
                                </a>
                            </li>
                        </ul>--%>
                    </nav>
                    <!-- pagination_top -->

                    <center>
                   <asp:GridView ID="GridView1" class="mgmttable" runat="server" ShowHeader="true"      AutoGenerateColumns="False" HeaderStyle-BackColor="#a93b56" HeaderStyle-ForeColor="White" RowStyle-HorizontalAlign="Center"  Width="100%" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand" OnDataBound="GridView1_DataBound" OnPreRender="GridView1_PreRender" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" >
                <Columns>
                    <asp:TemplateField SortExpression="ProductID" HeaderText="典藏碼" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("ProductID") %>' ID="TextBox1" ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("ProductID") %>' ID="Label1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
                    <asp:TemplateField SortExpression="ProductName" HeaderText="名稱(版本)" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                              <asp:TextBox runat="server" Text='<%# Bind("ProductName") %>' ID="TextBox2"  ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("ProductName") %>' ID="Label2"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
                    <asp:TemplateField SortExpression="Amount" HeaderText="數量(單位)" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                                <asp:TextBox runat="server" Text='<%# Eval("Amount") %>' ID="TextBox3" ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Amount") %>' ID="Label3"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField SortExpression="Size" HeaderText="尺寸規格" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                              <asp:TextBox runat="server" Text='<%# Eval("Size") %>' ID="TextBox4" ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Size") %>' ID="Label4"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField SortExpression="Kind" HeaderText="性質" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                      <asp:TextBox runat="server" Text='<%# Eval("Kind") %>' ID="TextBox5" ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Kind") %>' ID="Label5"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField SortExpression="OriginalHolder" HeaderText="原持有者" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("OriginalHolder") %>' ID="TextBox6"  ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("OriginalHolder") %>' ID="Label6"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField SortExpression="Worth" HeaderText="價值(元)" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Worth") %>' ID="TextBox7"    ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Worth") %>' ID="Label7"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="Material" HeaderText="材質" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Material") %>' ID="TextBox8"    ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Material") %>' ID="Label8"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="ObjectTime" HeaderText="年代" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("ObjectTime") %>' ID="TextBox9"   ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("ObjectTime") %>' ID="Label9"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="Maker" HeaderText="製造者(地)" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Maker") %>' ID="TextBox10"   ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Maker") %>' ID="Label10"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="Status" HeaderText="保存狀況" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Status") %>' ID="TextBox11"    ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Status") %>' ID="Label11"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="Place" HeaderText="存儲(陳展地點)" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Place") %>' ID="TextBox12"   ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Place") %>' ID="Label12"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="img" HeaderText="影像" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Worth") %>' ID="TextBox13"   ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Worth") %>' ID="Label13"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                        <asp:TemplateField SortExpression="Remark" HeaderText="備考(解說)" ItemStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" Text='<%# Bind("Remark") %>' ID="TextBox14"    ></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Remark") %>' ID="Label14"></asp:Label>
                        </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField SortExpression="" HeaderText="修改" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                                                 <asp:Button ID="Button3"  runat="server" Text="編輯" CommandArgument='<%# Container.DataItemIndex  %>' ForeColor="#ffffff" BackColor="#555555" BorderStyle="Solid" BorderColor="#555555" BorderWidth="1px" CommandName="edit_admin" Width="90%"  OnClick="Button3_Click" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
                       <HeaderStyle BackColor="#A93B56" ForeColor="White" />
                        <PagerSettings FirstPageText="首頁" LastPageText="末頁" NextPageText="下一頁" PageButtonCount="5"
                            PreviousPageText="上一頁" Mode="NumericFirstLast" Position="Top" />
                        <PagerStyle  Font-Names="宋体" Font-Size="14px" HorizontalAlign="Center"
                            CssClass="bubufxPagerCss" />
                       <RowStyle HorizontalAlign="Center" />
            </asp:GridView>
                         <br />
                        </center>
                </asp:Panel>




            </div>
        </div>
        <div class="mgcenter">

            <asp:Panel ID="Panel3" runat="server">
                <table class="inputTable">
                    <tr>
                        <th>典藏碼:</th>
                        <td>
                            <asp:TextBox ID="TextBox15" runat="server"></asp:TextBox>
                        </td>

                        <th>名稱(版本):</th>
                        <td>
                            <asp:TextBox ID="TextBox16" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>數量(單位):</th>
                        <td>
                            <asp:TextBox ID="TextBox17" runat="server"></asp:TextBox>
                        </td>

                        <th>尺寸規格:</th>
                        <td>
                            <asp:TextBox ID="TextBox18" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>性質:</th>
                        <td>
                            <asp:TextBox ID="TextBox19" runat="server"></asp:TextBox>
                        </td>

                        <th>原持有者:</th>
                        <td>
                            <asp:TextBox ID="TextBox20" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>價值(元):</th>
                        <td>
                            <asp:TextBox ID="TextBox21" runat="server"></asp:TextBox>
                        </td>

                        <th>材質:</th>
                        <td>
                            <asp:TextBox ID="TextBox22" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>年代:</th>
                        <td>
                            <asp:TextBox ID="TextBox23" runat="server"></asp:TextBox>
                        </td>

                        <th>製造者(地):</th>
                        <td>
                            <asp:TextBox ID="TextBox24" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>保存狀況:</th>
                        <td>
                            <asp:TextBox ID="TextBox25" runat="server"></asp:TextBox>
                        </td>

                        <th>存儲(陳展地點):</th>
                        <td>
                            <asp:TextBox ID="TextBox26" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>影像:</th>
                        <td>
                            <asp:Image ID="Image1" runat="server" Width="50px" Height="50px"></asp:Image>
                        </td>

                        <th>備考(解說):</th>
                        <td>
                            <asp:TextBox ID="TextBox28" runat="server" TextMode="MultiLine" Width="100%" Height="100%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>註銷:</th>
                        <td>
                            <asp:Button ID="Button4" runat="server" Text="註銷" ForeColor="#ffffff" BackColor="#555555" BorderStyle="Solid" BorderColor="#555555" BorderWidth="1px" Width="50%" OnClick="Button4_Click" />
                        </td>

                        <th>上傳圖檔:</th>
                        <td>
                            <asp:FileUpload ID="FileUpload1" runat="server"></asp:FileUpload>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <asp:Button ID="Button5" CssClass="btpick_brown" runat="server" Text="更新資料" Style="display: block; margin: auto" OnClick="Button5_Click" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </div>
        <!-- mgCenter -->
    </div>
</asp:Content>

沒有留言:

張貼留言

WPF聊天室应用(ASP.NET Core SignalR)

  WPF聊天室应用(ASP.NET Core SignalR) https://www.bilibili.com/video/BV1Q741187Si?p=2 https://www.bilibili.com/video/BV1UV411e75T?from=search&...