Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem.I have a button on ASP.Net.On button's Client click i call a javascript function which returns false always.I want to know how to execute server side code of this buttons click event.
My button is---------------

<asp:Button ID="btnprofileupdatesschool" runat="server" CssClass="bt_orgSmall"
OnClientClick="javascript:OnGetUpdateSchoolProfile();return false;"
meta:resourcekey="btnprofileupdatesschoolResource1" >




I want your help.
Thanks for your help
Posted
Updated 8-Jul-11 2:23am
v3
Comments
shefeekcm 8-Jul-11 8:36am    
provide your full code

Hi,
OnClientClick="OnGetUpdateSchoolProfile(); return false;"
try this one.
regards,
shefeek
 
Share this answer
 
v2
Comments
MDubey1987 8-Jul-11 8:11am    
Thanks but it still not workin :(
Hi..

Please remove return false from onclientclick()
 
Share this answer
 
Comments
MDubey1987 8-Jul-11 8:05am    
Thanks for your answer .But return false is necessary here so i can't remove it.
I want the help with this condition
"javascript:OnGetUpdateSchoolProfile();return false;"

remove double quotes and remove return false; from inline javascript

try this

'javascript:OnGetUpdateSchoolProfile()'



enjoy
 
Share this answer
 
v5
Comments
fjdiewornncalwe 8-Jul-11 7:48am    
The double quotes versus single quotes will have no effect. But your suggestion to remove the return false; is correct.
Sachin__Sharma 8-Jul-11 8:00am    
You are right but i am using asp.net 4.0 when i tried this code, it generated error so i additionally suggest that.
Do like this..

XML
<asp:Button ID="btnprofileupdatesschool" runat="server" CssClass="bt_orgSmall"
OnClientClick="javascript:OnGetUpdateSchoolProfile();return false;"
meta:resourcekey="btnprofileupdatesschoolResource1" OnClick="btnprofileupdatesschool_Click"/ > 



hope it will help you.
 
Share this answer
 
v2
Comments
MDubey1987 8-Jul-11 8:06am    
Thanks for your help.But its not working
You can't unless you remove the return false statement. What you could do, perhaps, is to get your event to do a PostBack and trigger the code behind. You can trigger a postback with __doPostBack[^].
 
Share this answer
 
Comments
fjdiewornncalwe 8-Jul-11 7:49am    
removing the return false is all that is required. (+5, btw)
MDubey1987 8-Jul-11 8:07am    
Thanks!!.Can you give an example how to do this
R. Giskard Reventlov 8-Jul-11 8:13am    
Read the article?
MDubey1987 8-Jul-11 8:18am    
which article?
Tarun.K.S 8-Jul-11 8:23am    
the link __doPostBack.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900