用户管理

 <asp:GridView ID="GridView1" runat="server" AllowPaging="true" AutoGenerateColumns="false"
             BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" 
             CellPadding="4" DataKeyNames="用户名" Height="87px" HorizontalAlign="Center"
             OnRowDeleting="GridView1_RowDeleting">
            <PagerSettings  FirstPageText="" LastPageText="" Mode="NextPrevious" 
                 NextPageText="下一页" PreviousPageText="上一页" PageButtonCount="6"/>
            <Columns>
                <asp:BoundField  DataField="用户名" HeaderText="用户名" ReadOnly="true"/>
                 <asp:BoundField  DataField="真实姓名" HeaderText="真实姓名" ReadOnly="true"/>
                 <asp:BoundField  DataField="电话" HeaderText="电话" ReadOnly="true"/>
                 <asp:BoundField  DataField="地址" HeaderText="地址" ReadOnly="true"/>
                <asp:BoundField  DataField="邮编" HeaderText="邮编" ReadOnly="true"/>               
                <asp:CommandField ShowCancelButton="false" ShowDeleteButton="true" />
            </Columns>
            <SelectedRowStyle  BackColor="#FFCC66" Font-Bold="true" ForeColor="#663399"/>
            <PagerStyle  BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center"/>

            <HeaderStyle BackColor="#990000" Font-Bold="true" ForeColor="#FFFFCC" />

        </asp:GridView>

public partial class delusers : System.Web.UI.Page
{
    BaseClass ba = new BaseClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        bindgrig();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        String strsql = "delete from 用户表 where 用户名='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        ba.execsql(strsql);
        bindgrig();
    }
    void bindgrig()
    {
        string strsql = "select * from 用户表 where 管理员标志=0";
        DataTable dt = ba.readtable(strsql);
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值