TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mokshasri
NA
31
0
onclientclick not working- asp.net 3.5
Dec 6 2009 4:22 PM
Hi!
I have the following in the head section of the .aspx file:
<
script
language
="javascript"
type
="text/javascript">
function
Validations()
{
if
(document.getElementById(
"TxtboxTo"
).Value== "")
{
alert(
'Enter atleast one email ID'
);
document.getElementById(
"TxtboxTo"
).focus();
return false;
}
else
if
(document.getElementById(
"txtboxmessage"
).value ==
""
)
{
alert(
'Please enter Password'
);
document.getElementById(
"txtboxmessage"
).focus();
return false;
}
else
{
return true;
}
}
And I am calling this javascript using onclientclick="return Validations();"
Also, I have onclick event for the button.
The problem, is that javascript function is not getting executed instead directly the onclick event is getting fired. I have tried onclientclick="return javascript:Validations();", onclientclick="javascript:Validations();", onclientclick=" Validations();", onclientclick=" Validations(); return;" etc., but nothing is working.
However, when I tried the following javascript:
function
Check()
{
alert(
'Testin'
);
}
</
script
>
and onclientclick="Check();", it is working perfectly.
Can anyone suggest me what I am doing wrong in Validations javascript?
How to make onclientclick and onclick both work so that only after javascript validations are complete to true then only onclick event gets fired.
Appreciate your quick response.
Thanks,
Mokshasri
Reply
Answers (
3
)
Which of the following accurately describes the class structure when implementing an Asp.Net page which used the codefile attribute?
When using asybchronous partial updates with an updatepanel ,which of the following are true?