i am having a button and two textfields all are asp.net server controls
on button click,the javascript function has to be called,which checks whether both the textfield's are empty r not
protected void Button1_Click(object sender, EventArgs e)
{
String c, d;
c = TextBox1.Text;
d = TextBox2.Text;
Button1.Attributes.Add("onclick", "validate('c','d')");
if (Page.IsValid == true)
{
Response.Redirect("webform2.aspx");
}
}
function validate(a,b)
{
if(document.getElementById('a').value == "" && document.getElementById('b').value == "")
{
alert("The Fields cannot be empty");
return false
}
else return true
}
wen i click the button wen the text fields are empty it is taking me to the next page... it should'nt happen wat to do