Click here to Skip to main content
16,012,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii Friends

I am creating button on my ".cs" file dynamically

code fore that is as below
C#
Button btn_remove = new Button();
            string btn_id = i.ToString();
            btn_remove.ID = btn_id;
            btn_remove.CssClass = "btn";
            btn_remove.Text = "remove";
            PlaceHolder1.Controls.Add(btn_remove);
            btn_remove.Click += new EventHandler(this.btn_remove_Click);
            //btn_remove.Attributes.Add("OnClientClick", "javascript :return remov_elem();");
           btn_remove.Attributes.Add("onClick", "javascript:return false");


I have a function in java script which I want to call on this dynamically created button's client click event.

Any one will please help me

My javascript function file is as below
JavaScript
function remov_elem()
            {
                alert("bhargav");
               return false;
            }
Posted

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