How to add dynamic controls in ASP NET with Addeventhandler
hi, today we will see how to add dynamic elements to table in asp.net
we will add dynamic controls and add events to them dynamically.
first we will create a table
add a label to see which control is clicked
now we will add 10 controls to it.
now we created 10 rows,10 linkbutton
add unique id to all 10 linkbutton
add the control linkbutton to one of the table cell
we have added the linkbutton to one of the table cell
the other table cell has the number. add the 2 cells to table row
then add the tablerow to the table
we will now see the result
lets add events to them dynamically
when a linkbutton is clicked, it's number should be displayed.
link the procedure with linkbutton click
find the linkbutton's id
now we found the table's row id in which the linkbutton is clicked.
we will set the id in the label,