<body>
<div class="container">
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title">General Elements</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="col-md-8">
<form role="form" runat="server" id="loginForm">
<!-- text input -->
<div class="form-group">
<label>Enter your name</label>
<input type="text" class="form-control" name="name" id="txtname" runat="server" placeholder="Enter your Name"/>
</div>
<div class="form-group">
<label>Email</label>
<input type="text" class="form-control" name="email" id="txtemail" runat="server" placeholder="Enter your Email"/>
</div>
<div class="form-group">
<label>User name</label>
<input type="text" class="form-control" name="username" id="txtusername" runat="server" placeholder="Enter your Username"/>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" name="password" id="txtpassword" runat="server" placeholder="Enter your Password"/>
</div>
<div class="form-group">
<label>Confirm Password</label>
<input type="password" class="form-control" name="confirm" id="txtconfirm" runat="server" placeholder="Confirm your Password"/>
</div>
<asp:Button ID="btnSubmit" runat="server" Text="Button" OnClick="btnSubmit_Click1" OnClientClick="ValidatePassword();" />
<div id="checkusernameoremail" runat="server">
<asp:Label ID="lblStatus" runat="server"></asp:Label>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
above is the HTML code of the form. and below is the asp.net of this form
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BO;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
namespace DL
{
public class UserDL
{
int result;
public bool AddUserDetails(UserBO objbo)
{
using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["sqlcon"].ToString()))
{
try
{
con.Open();
SqlCommand cmd = new SqlCommand("Sp_insertUserDetails", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@name", objbo.name);
cmd.Parameters.AddWithValue("@email", objbo.email);
cmd.Parameters.AddWithValue("@username", objbo.username);
cmd.Parameters.AddWithValue("@password", objbo.password);
cmd.Parameters.AddWithValue("@confrimPassword", objbo.confrimPassword);
result = cmd.ExecuteNonQuery();
con.Close();
if(result > 0)
{
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
throw ex;
}
}
}
}
}
and here comes the sql.
create table Form( id int identity(1,1) primary key (id), name varchar(50),email varchar(50),
username nvarchar(50),password nvarchar(50),confrimPassword nvarchar(50));
select * from form;
drop table Form;
drop procedure Sp_insertUserDetails;
go
create Procedure Sp_insertUserDetails
(
@name Varchar(200),
@email Varchar(200),
@username nVarchar(50),
@password nvarchar(50),
@confrimPassword nvarchar(50))
As
Begin
SET NOCOUNT ON;
IF EXISTS(SELECT * FROM [Form] WHERE email = @email )
BEGIN
SELECT 'FALSE'
END
ELSE
BEGIN
Insert into Form(name, email, username, password,confrimPassword)
Values(@name, @email, @username, @password,@confrimPassword)
SELECT 'TRUE'
End
END
GO
select *
from Form;
help me out to get the jQuery.