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();
}
}