Minor Improvements to logincontrol in Asp.net 2.0

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.