<pre lang="c#"><pre lang="c#">
For Example This is your Dropdown
<asp:DropDownList ID="ddl_loginType" runat="server" align="center" AutoPostBack="true">
<asp:ListItem Value="1" Text="">Student</asp:ListItem>
<asp:ListItem Value="2" Text="">Teacher</asp:ListItem>
</asp:DropDownList>
and this is code behind
<pre>if (ddl_loginType.SelectedValue == "1")
{
int count = 0;
count = School.Student.getlogin(tb_username.Text, tb_LgnPassword.Text);
if (count > 0)
{
Response.Redirect("StudentList.aspx");
}
else
{
lb_lgnError.InnerText = ("Incorrect UserName or Password");
lb_lgnError.Visible = true;
}
}
else
{
int count = 0;
count = School.Teacher.Teacherslogin(tb_username.Text, tb_LgnPassword.Text);
if(count>0)
{
Response.Redirect("TeacherInfo.aspx");
}
else
{
lb_lgnError.InnerText = ("Incoorect Username Password");
lb_lgnError.Visible = true;
}
}
i made it by using c# 3 tier architecture please change your code accordingly...