1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserInfo.aspx.cs" Inherits="user_UserInfo" %>  
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7. <title>无标题页</title>  
  8. <script type="text/javascript">  
  9.  
  10. function pageLoad() {  
  11. }  
  12.  
  13. </script>  
  14. </head>  
  15. <body>  
  16. <form id="form1" runat="server">  
  17. <div>  
  18.  
  19. </div>  
  20. <asp:AccessDataSource ID="AccessDataSource1" runat="server"   
  21. DataFile="~/App_Data/Employee.mdb" DeleteCommand="DELETE FROM Employee where id=?"   
  22. InsertCommand="INSERT INTO Employee(name,sex,department) VALUES (?,?,?)"   
  23. SelectCommand="SELECT * FROM [Employee]"   
  24. UpdateCommand="UPDATE Employee SET name =?, sex =?, department =? where id=?">  
  25. <DeleteParameters>  
  26. <asp:Parameter Name="id" />  
  27. </DeleteParameters>  
  28. <UpdateParameters>  
  29. <asp:Parameter Name="name" />  
  30. <asp:Parameter Name="sex" />  
  31. <asp:Parameter Name="department" />  
  32. <asp:Parameter Name="id" />  
  33. </UpdateParameters>  
  34. <InsertParameters>  
  35. <asp:Parameter Name="name" />  
  36. <asp:Parameter Name="sex" />  
  37. <asp:Parameter Name="department" />   
  38. </InsertParameters>  
  39. </asp:AccessDataSource>  
  40. <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID"   
  41. DataSourceID="AccessDataSource1" InsertItemPosition="LastItem">  
  42. <ItemTemplate>  
  43. <tr style="background-color: #E0FFFF;color: #333333;">  
  44. <td>  
  45. <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />  
  46. <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />  
  47. </td>  
  48. <td>  
  49. <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />  
  50. </td>  
  51. <td>  
  52. <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />  
  53. </td>  
  54. <td>  
  55. <asp:Label ID="sexLabel" runat="server" Text='<%# Eval("sex") %>' />  
  56. </td>  
  57. <td>  
  58. <asp:Label ID="departmentLabel" runat="server"   
  59. Text='<%# Eval("department") %>' />  
  60. </td>  
  61. </tr>  
  62. </ItemTemplate>  
  63. <AlternatingItemTemplate>  
  64. <tr style="background-color: #FFFFFF;color: #284775;">  
  65. <td>  
  66. <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />  
  67. <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />  
  68. </td>  
  69. <td>  
  70. <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />  
  71. </td>  
  72. <td>  
  73. <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />  
  74. </td>  
  75. <td>  
  76. <asp:Label ID="sexLabel" runat="server" Text='<%# Eval("sex") %>' />  
  77. </td>  
  78. <td>  
  79. <asp:Label ID="departmentLabel" runat="server"   
  80. Text='<%# Eval("department") %>' />  
  81. </td>  
  82. </tr>  
  83. </AlternatingItemTemplate>  
  84. <EmptyDataTemplate>  
  85. <table runat="server"   
  86. style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">  
  87. <tr>  
  88. <td>  
  89. 未返回数据。</td>  
  90. </tr>  
  91. </table>  
  92. </EmptyDataTemplate>  
  93. <InsertItemTemplate>  
  94. <tr style="">  
  95. <td>  
  96. <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" />  
  97. <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" />  
  98. </td>  
  99. <td>  
  100. &nbsp;</td>  
  101. <td>  
  102. <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />  
  103. </td>  
  104. <td>  
  105. <asp:TextBox ID="sexTextBox" runat="server" Text='<%# Bind("sex") %>' />  
  106. </td>  
  107. <td>  
  108. <asp:TextBox ID="departmentTextBox" runat="server"   
  109. Text='<%# Bind("department") %>' />  
  110. </td>  
  111. </tr>  
  112. </InsertItemTemplate>  
  113. <LayoutTemplate>  
  114. <table runat="server">  
  115. <tr runat="server">  
  116. <td runat="server">  
  117. <table ID="itemPlaceholderContainer" runat="server" border="1"   
  118. style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">  
  119. <tr runat="server" style="background-color: #E0FFFF;color: #333333;">  
  120. <th runat="server">  
  121. </th>  
  122. <th runat="server">  
  123. ID</th>  
  124. <th runat="server">  
  125. 姓名</th>  
  126. <th runat="server">  
  127. 性别</th>  
  128. <th runat="server">  
  129. 部门</th>  
  130. </tr>  
  131. <tr ID="itemPlaceholder" runat="server">  
  132. </tr>  
  133. </table>  
  134. </td>  
  135. </tr>  
  136. <tr runat="server">  
  137. <td runat="server"   
  138. style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">  
  139. <asp:DataPager ID="DataPager1" runat="server">  
  140. <Fields>  
  141. <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"   
  142. ShowLastPageButton="True" />  
  143. </Fields>  
  144. </asp:DataPager>  
  145. </td>  
  146. </tr>  
  147. </table>  
  148. </LayoutTemplate>  
  149. <EditItemTemplate>  
  150. <tr style="background-color: #999999;">  
  151. <td>  
  152. <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />  
  153. <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />  
  154. </td>  
  155. <td>  
  156. <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />  
  157. </td>  
  158. <td>  
  159. <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />  
  160. </td>  
  161. <td>  
  162. <asp:TextBox ID="sexTextBox" runat="server" Text='<%# Bind("sex") %>' />  
  163. </td>  
  164. <td>  
  165. <asp:TextBox ID="departmentTextBox" runat="server"   
  166. Text='<%# Bind("department") %>' />  
  167. </td>  
  168. </tr>  
  169. </EditItemTemplate>  
  170. <SelectedItemTemplate>  
  171. <tr style="background-color: #E2DED6;font-weight: bold;color: #333333;">  
  172. <td>  
  173. <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />  
  174. <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />  
  175. </td>  
  176. <td>  
  177. <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />  
  178. </td>  
  179. <td>  
  180. <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />  
  181. </td>  
  182. <td>  
  183. <asp:Label ID="sexLabel" runat="server" Text='<%# Eval("sex") %>' />  
  184. </td>  
  185. <td>  
  186. <asp:Label ID="departmentLabel" runat="server"   
  187. Text='<%# Eval("department") %>' />  
  188. </td>  
  189. </tr>  
  190. </SelectedItemTemplate>  
  191. </asp:ListView>  
  192. </form>  
  193. </body>  
  194. </html>