Create
The account administration would be quite useless if you couldn't create a new account. Figure 12-5 shows the AdmAcntCreate Web page that is designed for this task.
|
1 | |||
|
—J | |||
|
' < , 1——«- yf»» o - , |
"^•m^pJLa^ - |
■ | |
|
1 | |||
|
'ÂtlnLU |
™n Adjnhiiitrai&rj . Uidliui C"rcatt | ||
|
i'rr 4Bf Am | |||
|
frAJ | |||
|
[!*■] |
ViHlD r»" | ||
|
lumid | |||
|
tilir | |||
|
Tr'j : : i:l- :L -L-I K in^n i. ■:' v.Li MI M|I ■ Ï Ei^ | |||
|
dHH |
»jii^iFiT^ |
Figure 12-5: The AdmAcntCreate Web page Looking at Figure 12-5, you should spot something you haven't used before: the multiselect list box. The list box stores all the possible roles in the system that a user can have. Listing 12-21 shows the design code specific to the list box.
Listing 12-21: The Multiselect List Box
(Select role or ctrl click to select more than one role)</FONT>
<asp:ListBox id=lbRoles runat="server" Width="40%" SelectionMode="Multiple">
<asp:ListBox id=lbRoles runat="server" Width="40%" SelectionMode="Multiple">
The Codebehind to handle the list box (see Listing 12-22) is pretty straight-forward. The first time the page is built, the Role list box is loaded from an auxiliary database table called Roles that is made up of one column: Role. Then, when the user enters a valid page, you check to see if the username is already taken. If it is, you error out; otherwise, you insert all the information into the database.
Post a comment