-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Sri_Ram_78
Message 3 in Discussion
Hi
Balaji,
You need to add return statement before calling javascript
function like this ..
View.Attributes.Add("onClick","return
doDateCheck(StartDate,EndDate);");
Hope
this solves ur problem .
Rgds
Sriram
-----Original Message-----
From:
BalajiKrishnan [mailto:[EMAIL PROTECTED]
Sent: Friday, January
21, 2005 11:10 AM
To: BDOTNET
Subject: Calling Javascript
function on Image Button Click
New Message on BDOTNET
Calling
Javascript function on Image Button Click
Reply
Reply to Sender Recommend
Message 1 in
Discussion
From: BalajiKrishnan
Hi ALL,
<o:p> </o:p>
I have a image button (Server
side)<o:p></o:p>
On the image button click I am calling a function in
code behind<o:p></o:p>
<o:p> </o:p>
Now to validate two text boxes,I have added a javascipt
function, if the validation fails it should not submit and the
code behind function should not get
executed.<o:p></o:p>
<o:p> </o:p>
View.Attributes.Add("onClick","doDateCheck(StartDate,EndDate);");<o:p></o:p>
<o:p> </o:p>
function doDateCheck()
{ alert(from);
alert(to);
if (Date.parse(from.value) >
Date.parse(to.value))
{ alert("The dates are invalid.");
return false;
}
}<o:p></o:p>
I am getting the values in the javascript function and the
validation is also done, but the image button is getting
submitted and the code behind function is
called.<o:p></o:p>
<o:p> </o:p>
What could be the problem.<o:p></o:p>
<o:p> </o:p>
Balaji.<o:p></o:p>
<o:p> </o:p>
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]