Click here to Skip to main content
15,918,742 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to bind data to asp table with delete button
Posted
Updated 14-Sep-22 18:51pm

1 solution

This solution is for table with delete functionality in it.
Take asp table control on .aspx page and write below code on .cs page.
C#
TableRow TR = new TableRow();
TableCell TD;
TD = new TableCell();
TD.Text = "Code";
TR.Cells.Add(TD);

TD = new TableCell();
TD.Text = "Description";
TR.Cells.Add(TD);

TD = new TableCell();
TD.Text = "Delete";
TR.Cells.Add(TD);

this will create headers of table bind data by iterating on DT.
for delete functionality take LinkButton and call javascript onClick of button
C#
LinkButton lBtn = new LinkButton();
lBtn.Text = "Delete";
lBtn.ToolTip = "Click to Delete";
lBtn.Attributes.Add("onClick", "javascript:return delConfirm(this,parameters)");
 
Share this answer
 
v2

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