ASP.NET Page /Admin/User.aspx (C#)
Uses Code Behind Page Page /Admin/User.aspx.cs (C#)
1: <%@ Page Language="C#" AutoEventWireup="True" Inherits="Admin_User" Codebehind="User.aspx.cs" %>  
2:   
3:   
4:   
5: <html xmlns="http://www.w3.org/1999/xhtml" >  
6: <head runat="server">  
7:     <title>Admin - User maintenance</title>  
8: </head>  
9: <body>  
10:     <form id="form1" runat="server">  
11:     <asp:HyperLink ID="lblHome" runat="server" NavigateUrl="~/Admin/Default.aspx">Home</asp:HyperLink>  
12:     <div>  
13:         <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="UserID"  
14:             DataSourceID="SqlDataSource1">  
15:             <PagerSettings Mode="NextPreviousFirstLast" Position="Top" />  
16:             <EditItemTemplate>  
17:                 UserID:  
18:                 <asp:Label ID="UserIDLabel1" runat="server" Text='<%# Eval("UserID") %>'></asp:Label><br />  
19:                 Password:  
20:                 <asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>'>  
21:                 </asp:TextBox><br />  
22:                 <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"  
23:                     Text="Update">  
24:                 </asp:LinkButton>  
25:                 <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"  
26:                     Text="Cancel">  
27:                 </asp:LinkButton>  
28:             </EditItemTemplate>  
29:             <InsertItemTemplate>  
30:                 UserID:  
31:                 <asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>'>  
32:                 </asp:TextBox><br />  
33:                 Password:  
34:                 <asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>'>  
35:                 </asp:TextBox><br />  
36:                 <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"  
37:                     Text="Insert">  
38:                 </asp:LinkButton>  
39:                 <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"  
40:                     Text="Cancel">  
41:                 </asp:LinkButton>  
42:             </InsertItemTemplate>  
43:             <ItemTemplate>  
44:                 UserID:  
45:                 <asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>'></asp:Label><br />  
46:                 Password:  
47:                 <asp:Label ID="PasswordLabel" runat="server" Text='<%# Bind("Password") %>'></asp:Label><br />  
48:                 <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"  
49:                     Text="Edit">  
50:                 </asp:LinkButton>  
51:                 <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"  
52:                     Text="Delete">  
53:                 </asp:LinkButton>  
54:                 <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"  
55:                     Text="New">  
56:                 </asp:LinkButton>  
57:             </ItemTemplate>  
58:         </asp:FormView>  
59:         <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
60:             DeleteCommand="DELETE FROM [User] WHERE [UserID] = @UserID" InsertCommand="INSERT INTO [User] ([UserID], [Password]) VALUES (@UserID, @Password)"  
61:             SelectCommand="SELECT * FROM [User]" UpdateCommand="UPDATE [User] SET [Password] = @Password WHERE [UserID] = @UserID">  
62:             <DeleteParameters>  
63:                 <asp:Parameter Name="UserID" Type="String" />  
64:             </DeleteParameters>  
65:             <UpdateParameters>  
66:                 <asp:Parameter Name="Password" Type="String" />  
67:                 <asp:Parameter Name="UserID" Type="String" />  
68:             </UpdateParameters>  
69:             <InsertParameters>  
70:                 <asp:Parameter Name="UserID" Type="String" />  
71:                 <asp:Parameter Name="Password" Type="String" />  
72:             </InsertParameters>  
73:         </asp:SqlDataSource>  
74:       
75:     </div>  
76:     </form>  
77: </body>  
78: </html>  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.