How to correct my null exception??
- by kostas
hi!i have created a contact form using c# and web services.i would like to get an alert message if the user hasnt filled his name or when his name is a number.this is my c# code:
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Validation.WebService validate = new Validation.WebService();
bool ismail = validate.isEmail(TextBox2.Text);
if (!ismail)
{ Label1.Text = "your mail is wrong!!"; }
Validation.nameVal valid = new Validation.nameVal();
bool isname = valid.isName(TextBox1.Text);
if (!isname )
{ Label2.Text = "Your name is wrong!!"; }
else if (isname==null)
{ Label2.Text = "Please fill in your name"; }
if (isname && ismail)
{
{ Label1.Text = null; Label2.Text = null;
Label3.Text = "Your message has been send!";}
}
}
}
with this code i have a null exception..