Hi
Below is the code i m using for login page.but it does not enter to button click.and when i tried to put new button, its button click event opens in aspx page.
I m not getting where exactly the problem is.
protected void btnSubmit_Click(object sender, EventArgs e)
{
string password = "";
string query = "select AdminPwd from tbladminlogin where AdminId='" + txtUserName.Text + "'";
MySqlConnection objMyCon = new MySqlConnection(strProvider);
objMyCon.Open();
MySqlCommand cmd = new MySqlCommand(query, objMyCon);
MySqlDataReader r = cmd.ExecuteReader();
while (r.Read())
{
password = r[0].ToString();
}
if (password == "")
{
Session["Login"] = false;
lblMessage.Visible = true;
lblMessage.Text = "Invalid Username";
txtUserName.Text = "";
txtPwd.Text = "";
}
//
else
{
if (txtPwd.Text == password)
{
Session["Login"] = true;
Session["UserName"] = txtUserName.Text;
Response.Redirect("concertDetail.aspx");
}
else if (txtPwd.Text != password)
{
Session["Login"] = false;
lblMessage.Visible = true;
lblMessage.Text = "Invalid Password";
txtPwd.Text = "";
}
}
objMyCon.Close();
}
//aspx page
<div id="login">
<%--<div class="response-msg success ui-corner-all">
<span>Success message</span>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit
</div>--%>
<asp:Label ID="lblMessage" runat="server" Text="Label" Font-Size="Medium" ForeColor="Red"></asp:Label>
<form id="Form1" runat="server">
<ul>
<li>
<label for="email" class="desc">
Username:
</label>
<div>
<%--<input type="text" tabindex="1" maxlength="255" value="" class="field text full" name="email" id="email" />--%>
<asp:TextBox ID="txtUserName" runat="server" MaxLength="255" Width="470px"></asp:TextBox>
</div>
</li>
<li>
<label for="password" class="desc">
Password:
</label>
<div>
<%--<input type="text" tabindex="1" maxlength="255" value="" class="field text full" name="password" id="password" />--%>
<asp:TextBox ID="txtPwd" runat="server" MaxLength="255" Width="470px"></asp:TextBox>
</div>
</li>
<li class="buttons">
<div style="position: relative; top: -4px; left: 408px; width: 67px; height: 32px;">
<div style="position: relative;">
</div>
<%--<button class="ui-state-default ui-corner-all float-right ui-button" onclick="btnSubmit_Click" type="submit">Login</button>--%>
<asp:Button ID="btnSubmit" runat="server" Text="Login" OnClick="btnSubmit_Click" />
</div>
</li>
</ul>
</form>
The onclick event below searches for a function “btnSubmit_Click” in javascript and not code-behind, since the button is an html control:
As for as the asp:Button is concerned, it should work. There doesn’t seem to be any problem in it. Please check that the ASP.NET Development server is not already running. Next clear your cache and check if debugging is enabled in your browser.
As far as the double click issue is concerned, you should disable it. The best solution to this, in my knowledge is to deal with it on client-side like this:
………………………………….