

I have this issue of a drop down menu for my login. When I press the Log In link the drop down menu slides down. What I want is when wrong credentials are given to do not postback(refresh) so that the drop down menu will stay open for the user to type the correct password!
I have tried OnClientClick=”return false;” but this disables the onclick event of my asp:button.
My code behind:
string insCmd = "SELECT ID_USER FROM users WHERE username = @LoginEmail AND password = @passwd;";
SqlCommand Login = new SqlCommand(insCmd, con);
Login.Parameters.AddWithValue("@LoginEmail", txtLoginEmail.Text);
Login.Parameters.AddWithValue("@passwd", txtLoginPassword.Text);
try
{
SqlDataReader dr = Login.ExecuteReader();
SqlDataReader dr2;
if (dr == null || !dr.HasRows)
{
litErrorLogin.Text = "<span>Error:Wrong Credentials</span>";
//btnLogin.OnClientClick = "return false;";
return;
}
while (dr.Read())
{
Session["UserID"] = dr.GetInt32(0);
}
My html code:
<div id="bb_loginForm">
<div class="bg_loginForm">
<span style="font-size:11.5px;font-weight:bold">Log in to Account</span> <a class="bb_linkLoginHeaderHide" href="#" title="Hide">
Hide</a>
<br />
<div class="f_username">
<label for="txtLoginEmail" id="labelUser">
Email
</label>
<br />
<asp:TextBox class="text-input" ID="txtLoginEmail" runat="server" Height="15px" Width="130px"></asp:TextBox>
</div>
<div class="f_password">
<label for="txtLoginPassoword" id="labelPassword">
Password
</label>
<br />
<asp:TextBox class="text-input" ID="txtLoginPassword" runat="server" Height="15px" Width="130px"
TextMode="Password"></asp:TextBox>
</div>
<br />
<div class="f_login">
<!--src="../images/GreyButton.png" class="submit btn primary-btn" onclick="btnLogin_Click"-->
<asp:Button class="submit google-button" ID="btnLogin" onclick="btnLogin_Click" runat="server" Text="Log in" />
<br />
<asp:CheckBox ID="chkRememberLogin" runat="server" />
<label class="smaller" for="chkRememberLogin" id="labelrememberusername">Remember me
</label>
<br />
<a title="Forgot your login info?" href="#" class="underlineHover">Forgot your login
info? </a>
<br />
<asp:Literal ID="litErrorLogin" runat="server"></asp:Literal>
</div>
</div>
</div>
You cna develop based on
Ajaxin order to don’t post all your page, but you post just part of your page. (Updates partial page)You set all controls that you don’t want post outside of
ContentTemplateNota : i fixed
updatemode="Conditional"and<asp:AsyncPostBackTrigger controlid="btnLogin" eventname="Click" />