in THE BELOW CODE OnClientClick not Firing plz Help me for this problem...
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal GilbileRank #268 · 9.4K reputationPosted Apr 11, 2013, 10:59 PM EDT
you should use return statement only when your function is returning any value. Well now whenever your function returns any value the syntax for calling the function on OnClintClick would be like the following.
Note: When you function returns value.
OnClientClick="javascript:return FunctionName()";
If your function is not returning any value you could easily call it like the following.
OnClientClick="FunctionName();"
Also for accessing the Server side control in your javascript code, the way of accessing is different.
For instance if you are writing this javascript code on your Child page Or Content Page
the way would be
var txtValue=document.getElementById('<%=txtEmpName.ClientID%>').value;
If your page is normal webpage i.e. no master page applied on it then the way for accessing server control would be like the following.
var txtValue=document.forms[0]["txtEmpName"].value;
Hope that solves your problem.
With Regards,
Vishal Gilbile.
Sathish Pabbathi99 reputationPosted Apr 11, 2013, 11:11 PM EDT
Vishal GilbileRank #268 · 9.4K reputationPosted Apr 11, 2013, 11:12 PM EDT
With Regards,
Vishal Gilbile.
Gaurav GuptaRank #123 · 17.8K reputationPosted Apr 11, 2013, 11:32 PM EDT
And
Put the Code on the OnClientClick event...
OnClientClick ="return Confirm("Are sure want to add new Record ?:");"
Vishal GilbileRank #268 · 9.4K reputationPosted Apr 12, 2013, 12:15 AM EDT
if (txt1 ==0)
{
alert("plz fill the employe's First name!!");
}
with
if (txt1 =="" || txt1=="0")
{
alert("plz fill the employe's First name!!");
return false;
}
if(x==true)
return true;
else
return false;
Hope that helps you.
With Regards,
Vishal Gilbile.
Sathish Pabbathi99 reputationPosted Apr 12, 2013, 2:35 AM EDT
Sathish Pabbathi99 reputationPosted Apr 12, 2013, 8:04 PM EDT