Just use the event handler type as the argument type:
public static void BuildPaging(Control pagingControl
, short currentPage
, short totalPages
, EventHandler eh
)
{
for (int i = 0; i < totalPages; i++)
{
LinkButton pageLink = new LinkButton();
...
pageLink.Click += eh;
pagingControl.Controls.Add(paheLink);
}
}
Note. Remember to remove the event handler when this is done, or you may leak from memory!
source
share