I would like to know if it is possible to assign "metadata" to an asp.net control that could be retrieved later in a post back? For instance, imagine that I have a LinkButton:
LinkButton link = new LinkButton();
link.ID = "LinkButton_0";
link.Text = "Click here for more info";
link.Click += new EventHandler(link_Click);
Now I want to assign more data to the control so that when the post back event occurs I can retrieve this data to find out what to do. I thought about using the "Attributes" property but I guess it is not a good solution because it may affect the control's html layout:
link.Attributes.Add("param0", "value0");
link.Attributes.Add("param1", "value1");
link.Attributes.Add("param2", "value2");
I need to do this because my page has plenty of link buttons that are created dynamically and all of them raise the same post back event.
Some people suggested I simply concatenate all "metadata" in the control's ID, but I'm trying to find a better solution.
Thanks.