Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to call client side javascript function in button click event.need some
example code
Posted

C#
<asp:button id="Button1" runat="server" text="Button" onclientclick="javascript:alert('hello');"  /> 

or 

<asp:button id="Button1" runat="server" text="Button" onclientclick="javascript:YourFunction();"/> 
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 17-Aug-11 2:31am    
Good one! 5+
Uday P.Singh 17-Aug-11 3:58am    
my 5 too!
try this on page load

Button1.Attributes.Add("OnClick", "javascript:function()");
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 17-Aug-11 2:31am    
That should do it! 5+
Uday P.Singh 17-Aug-11 3:58am    
my 5 too!

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