前台代码 管理员代号在第一列 管理员名称第二列 删除第三列 管理员身份第四列 更改身份第5列
- C# code
<asp:GridView ID="gvEditMember" runat="server" AllowPaging="True" AutoGenerateColumns="False" PageSize="5" DataKeyNames ="ID" Width="100%" HorizontalAlign="Center" CssClass="txt" HeaderStyle-CssClass="summary-title" OnPageIndexChanging="gvEditMember_PageIndexChanging" OnRowCancelingEdit="gvEditMember_RowCancelingEdit" OnRowDeleting="gvEditMember_RowDeleting" OnRowEditing="gvEditMember_RowEditing" OnRowUpdating="gvEditMember_RowUpdating" OnRowDataBound="gvEditMember_RowDataBound" Height="225px" CellPadding="4" EnableModelValidation="True" ForeColor="#333333" GridLines="None"> <EditRowStyle BackColor="#2461BF" /> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <HeaderStyle Font-Bold="True" CssClass="summary-title" BackColor="#507CD1" ForeColor="White"></HeaderStyle> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:BoundField DataField="admin_id" HeaderText="管理员代号" ReadOnly="True" > <ItemStyle HorizontalAlign="Left" Width="80px" /> <HeaderStyle HorizontalAlign="Left" /> </asp:BoundField> <asp:BoundField DataField="admin" HeaderText="管理员名称" ReadOnly="True"> <ItemStyle HorizontalAlign="Left" /> <HeaderStyle HorizontalAlign="Left" /> </asp:BoundField> <asp:CommandField ShowDeleteButton="True" <ItemStyle HorizontalAlign="Left" Width="30px" /> </asp:CommandField> <asp:BoundField DataField="class" HeaderText="管理员身份" > <HeaderStyle HorizontalAlign="Left" /> <ItemStyle HorizontalAlign="Left" /> </asp:BoundField> <asp:CommandField ShowEditButton="True" EditText="更改身份" /> </Columns> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#EFF3FB" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> </asp:GridView>