简体   繁体   中英

Adding Link button Event Dynamically

I am Creating a Table Dynamically by passing a html code to a sting.

Now I want to add a link button and If i click on that then that row i want to delete.

please help me thanks in Advance

Try to create the linkbutton first and bind event with the button... for example

       HtmlGenericControl td = new HtmlGenericControl("td");
       LinkButton lnk = new LinkButton();
       //lnk.ID = set your dynamic ID;
       lnk.Text = "Delete";
       lnk.Click += new EventHandler(Clicked);

       td.Controls.Add(lnk);

Now create the function for click on button

       protected void Clicked(object sender, EventArgs e)
       {
          // do work on click...

       }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM