Click here to Skip to main content
16,017,312 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create buttons dynamically and Call the event of that dynamically generated button.
Posted

i am sure there is more good ways to do this. But i use below code to do this.

This is for calling a javascript function.
C#
Button btn = new Button();
btn.Text = "click";
btn.Attributes.Add("onclick", "call_csharp_function()");

in your javascript
JavaScript
 function call_csharp_function(){
   <%=csharp_function_name()%>
}
 
Share this answer
 

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