1. Add GridView to the page, modify the control name Gvuser
2. Set Data source DataSource (ObjectDataSource, etc.)
3. Set the DataKeyNames property of the GridView, delete operation is to follow this primary key to delete
4. Modify the code of the GridView, add modify to the inside, delete the button
<asp:gridview id= "Gvuser" runat= "Server"
autogeneratecolumns= "False" datakeynames= "UserId"
Datasourceid= "Objectdatasourceuser" onrowdeleted= "gvuser_rowdeleted" >
<Columns>
<asp:boundfield datafield= "UserId" headertext= "UserId"
sortexpression= "UserId"/>
<asp:boundfield datafield= "UserName" headertext= "UserName"
sortexpression= "UserName"/>
<asp:boundfield datafield= "Userpass" headertext= "Userpass"
sortexpression= "Userpass"/>
<asp:boundfield datafield= "role" headertext= "role" sortexpression= "role"/>
<asp:boundfield datafield= "Regtime" headertext= "Regtime"
sortexpression= "Regtime"/>
<asp:boundfield datafield= "Lognum" headertext= "Lognum"
sortexpression= "Lognum"/>
<asp:commandfield showeditbutton= "True" headertext= "Operation"/>
<asp:templatefield showheader= "False" >
<ItemTemplate>
<asp:linkbutton id= "Lbdelete" runat= "Server" causesvalidation= "False"
onclientclick= "return confirm (' Are you sure you want to delete it? ')" text= "Delete" commandname= "delete" ></asp:LinkButton>
</ItemTemplate>
<itemstyle horizontalalign= "Center" verticalalign= "Middle"/>
</asp:TemplateField>
</Columns>
</asp:GridView>