我们可以首先选择login control,并且将其转换为模版列,在其中加上一个dropdownlist,如下:
<asp:Login ID="Login1" runat="server" OnLoggingIn="Login1_LoggingIn">
<LayoutTemplate>
….
<asp:DropDownList id=”companies” runt=”server” …>
….
</asp:DropDownList>
….
</LayoutTemplate>
</asp:Login>
然后在login控件的Authenticate事件中,写入如下代码:
protected void Login1_ Authenticate (object sender, AuthenticateEventArgs e)
{
string company:
DropDownList companies = Login1.FindControl("companies ") as DropDownList;
if (companies != null)
company = companies.SelectedValue;
…
//Validate the user..
e.Authenticated = true;
}