In Asp.net 2.0, It is very convenient to log on to the control box logincontrol, but sometimes you may need
The logincontrol box is improved. For example, if you want to use the user name column, use the dropdownlist method to select
The user name or role you want to log on to is sometimes very convenient.
However, if you want to remove the username input box in logincontrol, it will fail. In fact, you can enter this username field.
Set the visible attribute of to false. You can add a drop-down box, as shown in the following example.
<TD align = "right">
<Asp: Label id = "usernamelabel" runat = "server"
Associatedcontrolid = "username"> User name: </ASP: Label>
</TD>
<TD>
<Asp: textbox id = "username" runat = "server"
Visible = "false" > </ASP: textbox>
<Asp: dropdownlist id = "dropdownlist1" runat = "server"/>
</TD>
Then, if you want to use the membership function of Asp.net 2.0 (in fact, it is not easy to use), you can combine dropdonwlist
Objectdatasource binding:
<Asp: dropdownlist id = "dropdownlist1" runat = "server" performanceid = "objectperformance1"/>
<Asp: objectdatasource id = "objectperformance1" dataobjecttypename = "system. web. security. membershipuser "runat =" server "selectmethod =" getallusers "typename =" system. web. security. membership "> </ASP: objectdatasource>
to obtain the user name selected from the drop-down list, it is easy to
protected void login1_loggingin (Object sender, logincanceleventargs E)
{< br> login1.username = (dropdownlist) login1.findcontrol ("dropdownlist1 ")). selectedvalue;
}< br> capture logginin events.