C#列表页面

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yang_sink/article/details/85318074

前台页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Page_Index" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>首页</title>
    <style type="text/css">

        .pageBar
        {
            margin-top: 10px;
        }
        .pageBar a
        {
            color: #333;
            font-size: 12px;
            margin-right: 10px;
            padding: 4px;
            border: 1px solid #ccc;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="btnConnect" runat="server" Text="连接oracle数据库" OnClick="btnConnect_Click" />
        <asp:Button ID="btnAdd" runat="server" Text="测试数控添加" OnClick="btnAdd_Click" />
        <asp:Button ID="btnGetData" runat="server" Text="查询数据" OnClick="btnGetData_Click" />        
         <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand" OnItemDataBound="Repeater1_ItemDataBound">
            <HeaderTemplate>
                <table border="1" style="width:1000px;text-align:center;border-collapse:collapse;">
                    <thead style="background-color:gray;">
                        <tr>
                            <th>ID</th>
                            <th>内容</th>
                            <th>操作</th>
                        </tr>
                    </thead>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Panel ID="plItem" runat="server">
                    <tr>
                        <td><asp:Label runat="server" ID="lblID" Text='<%#Eval("id") %>'></asp:Label></td>
                        <td><%#Eval("name") %></td>
                        <td>
                            <asp:LinkButton ID="lbtEdit" CommandName="Edit" CommandArgument='<%#Eval("id") %>' runat="server">编辑</asp:LinkButton>
                            <asp:LinkButton ID="lbtDelete" CommandName="Delete" CommandArgument='<%#Eval("id") %>' runat="server">删除</asp:LinkButton>
                        </td>
                    </tr>
                </asp:Panel>
                <asp:Panel ID="plEdit" runat="server">
                    <tr>
                        <td><asp:Label runat="server" ID="Label1" Text='<%#Eval("id") %>'></asp:Label></td>
                        <td><asp:TextBox ID="txtName" runat="server" Text='<%#Eval("name") %>'></asp:TextBox></td>
                        <td>
                            <asp:LinkButton ID="lbtCancel" CommandName="Cancel" CommandArgument='<%#Eval("id") %>' runat="server">取消</asp:LinkButton>
                            <asp:LinkButton ID="lbtUpdate" CommandName="Update" CommandArgument='<%#Eval("id") %>' runat="server">更新</asp:LinkButton>
                        </td>
                    </tr>
                </asp:Panel>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        
    </div>
        <div class="pageBar">
        <asp:Literal ID="ltlPageBar" runat="server"></asp:Literal>
    </div>
    </form>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/yang_sink/article/details/85318074