A
Anup
In my form I and doing validations using 'Javascript' as I m using
ASP1.1 and there is very less support for Validators there.
//Code Behind
private void Page_Load(object sender, System.EventArgs e)
{
Button1.Attributes.Add("OnClick","fun()");
}
Problem in using "Button1.Attributes.Add " for client side script for
Validations
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Hello, World");
}
//Client Side Script
<script language="javascript">
function fun()
{
if (document.Form1.TextBox1.value != '')
{
alert("Hello");
return true;
}
else
{
alert("World")
return false;
}
}
</script>
What I need to do is, if TextBox1 is Empty, Response.Write("Hello,
World") should not get executed, i.e. The Code written in Button should
not be executed.
What Should I do??
Thanks and Regards
Anup
ASP1.1 and there is very less support for Validators there.
//Code Behind
private void Page_Load(object sender, System.EventArgs e)
{
Button1.Attributes.Add("OnClick","fun()");
}
Problem in using "Button1.Attributes.Add " for client side script for
Validations
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Hello, World");
}
//Client Side Script
<script language="javascript">
function fun()
{
if (document.Form1.TextBox1.value != '')
{
alert("Hello");
return true;
}
else
{
alert("World")
return false;
}
}
</script>
What I need to do is, if TextBox1 is Empty, Response.Write("Hello,
World") should not get executed, i.e. The Code written in Button should
not be executed.
What Should I do??
Thanks and Regards
Anup