I have a class that inherits from the LinkButton ASP.NET control to include an int "Value" property for remembering a database ID when creating LinkButtons dynamically. This is so I can load some database driven content based on that ID on postback.
My question is: Is there a simple way to achieve this in C#? I have had a look around the internet and got a lot of info on delegates & custom event handling but it seems overly complex for what I need to do. Should I be reading up on delegates, generics & events or can I just override the LinkButtons Click event to capture the ID and query the DB?
EDIT
I'm creating my controls dynamically so I'm not sure how to link up an event to the click event of the dynamically added control. I take the points below about the CommandArgument property but does anyone have an example of using CommandArgument with a dynamically created control?
var lnkbtnTitle = new LinkButton();
lnkbtnTitle.CssClass = "ABC";
lnkbtnTitle.ToolTip = Description;
lnkbtnTitle.Text = Name + ' ' + Version;
lnkbtnTitle.CommandArgument = ID.ToString();
pnlHelpGuidesView.Controls.Add(lnkbtnTitle);