User639567535 posted
i have a signup form and also i apply validation
when user fill all fields data save in database and this work fine but when user enter data and miss one field e.g phone number or any other filed
then click on signup button then this data alwasys save in database
but i want when any user miss one r two or three fields then other data not save in database until user complete all fields
here is signup code.
protected void Btn_Save_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txt_fullname.Value))
{
LbelName.Text= "Please fill this";
}
else if(string.IsNullOrEmpty(txt_password.Value))
{
LbelPass.Text="Please fill this";
}
else if(string.IsNullOrEmpty(txt_mail.Value))
{
LbelEmail.Text="Please fill this";
}
else if(string.IsNullOrEmpty(txt_number.Value))
{
LbelNumber.Text="Please fill this";
}
try
{
ab.Userssign(txt_fullname.Value,txt_password.Value,txt_mail.Value,txt_number.Value);
//cc.getusername(TextBox1.Text);
//sig.Text = ("Register Success");
Label5.Text = ("Signup Success");
}
catch
{
Label6.Text = ("SignUp failed");
}
txt_fullname.Value= "";
txt_password.Value = "";
txt_mail.Value = "";
txt_number.Value="";
}
}
}
and signup function
public void Userssign(string username, string password, string email, string phonenumber)
{
db.ExecuteReader("spusersignup", new object[] { username, password, email, password });
}