TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Harish Batchu
NA
255
70.3k
Please any one help me out button click event is not working
Oct 5 2018 3:34 AM
Hii i will shaare my code
<form id="form1" method="post" runat="server">
<div class="panel-body">
<div class="row">
<div class="col-lg-12">
<div id="login-form" role="form" style="display: block;">
<div class="form-group">
<input type="text" name="username" runat="server" id="username" tabindex="1" class="form-control" placeholder="Username" value="">
<asp:RequiredFieldValidator ID="Usernamerequired" runat="server" ControlToValidate="username" ErrorMessage="Username is Requied" />
</div>
<div class="form-group">
<input type="password" name="password" id="password" runat="server" tabindex="2" class="form-control" placeholder="Password">
<asp:RequiredFieldValidator ID="Passwordrequired" runat="server" ControlToValidate="password" ErrorMessage="Password is Required" />
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<asp:Button ID="Button2" runat="server" Text="Log In" OnClick="Button2_Click" name="login-submit" tabindex="4" class="form-control btn btn-login" />
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-12">
<div class="text-center">
<a href="" tabindex="5" class="forgot-password">Forgot Password?</a>
</div>
</div>
</div>
</div>
</div>
<div id="register-form" role="form" style="display: none;">
<div class="form-group">
<input type="email" name="email" runat="server" id="email" tabindex="1" class="form-control" placeholder="Email Address" value="">
<asp:RequiredFieldValidator ID="RequiredEmail" runat="server" ControlToValidate="email" ErrorMessage="Provide Email" />
<asp:RegularExpressionValidator ID="RegularExpressionEmail" runat="server" ControlToValidate="email" ErrorMessage="Enter Correct Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"/>
</div>
<div class="form-group">
<input type="text" name="mobilenumber" id="mobilenumber" runat="server" tabindex="1" class="form-control" placeholder="Phone Number" value="">
<asp:RequiredFieldValidator ID="RequiredMobile" runat="server" ControlToValidate="mobilenumber" ErrorMessage="Provide Mobile Number" />
<asp:RegularExpressionValidator ID="RegularExpressionMobile" runat="server" ControlToValidate="mobilenumber" ErrorMessage="Enter correct Mobile Number" ValidationExpression="[0-9]{10}"/>
</div>
<div class="form-group">
<input type="password" name="password" id="password1" runat="server" tabindex="2" class="form-control" placeholder="Password">
<asp:RequiredFieldValidator ID="RequirdPass" runat="server" ControlToValidate="password1" ErrorMessage="Password Is Required" />
</div>
<div class="form-group">
<input type="password" name="confirm-password" id="confirmpassword" runat="server" tabindex="2" class="form-control" placeholder="Confirm Password">
<asp:RequiredFieldValidator ID="RequiredconfirmPassword" runat="server" ControlToValidate="confirmpassword" ErrorMessage="Confitm Password Is requird" />
<asp:CompareValidator ID="ComparePassword" runat="server" ControlToValidate="confirmpassword" ControlToCompare="password1" ErrorMessage=""/>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<asp:Button ID="Button1" runat="server" Text="Register Now" OnClick="Button1_Click" tabindex="4" class="form-control btn btn-login" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
In this code when click the valaditon is showing but when click to hit database it's not working
protected void Button2_Click(object sender, EventArgs e)
{
string luname = username.Value;
string lpassword = password.Value;
cmd = new SqlCommand("select User_Email,User_Password from Dim_Users where User_Email='"+luname+"',User_Password='"+lpassword+"'");
int i = cmd.ExecuteNonQuery();
if(i != 0)
{
Response.Redirect("Home.aspx");
con.Close();
}
else
{
Response.Redirect("Error.aspx");
con.Close();
}
}
Reply
Answers (
4
)
What is the difference between @model and @@model in mvc
All Possible ways to creating Link Button in mvc.