title: Change the style of one dynamically created LinkButton while not affecting others?
body: <p>I have a method that loops through a list and creates Links using the LinkButton control.  For the purpose of this question, assume that it is a list of colors and that I have 5 colors: red, green, blue, red, and yellow.  Here is a code snippet of how I am creating the links and adding the event handler.</p>
  
  <pre><code>foreach(color in colors)
  {
      LinkButton lb = new LinkButton();
      lb.Text = color.name;
      lb.Click += new System.EventHandler(this.colorClick); 
      lb.CommandName = "CommandName";
      lb.CommandArgument = "CommandArgument";
      lb.ID = color.Id;
  }
  </code></pre>
  
  <p>In the even handler, colorClick, I am bolding the clicked link by doing the following:</p>
  
  <pre><code>protected void colorClick(object o, EventArgs e)
  {
      LinkButton lnk = (LinkButton)o;
      lnk.Style["font-weight"] = "bold";
  
      //Process clicked link.
  }
  </code></pre>
  
  <p>The above code works fine as far as bolding the currently clicked link, the problem I run into is that assume that the link clicked was Red, so Red would be bold, if I click Blue, I want to bold the link Blue, but unbold Red.  I have tried:</p>
  
  <pre><code>lnk.Style["font-weight"] = "normal";
  lnk.Font.Bold = "false";
  </code></pre>
  
  <p>but, it occured to me that while the above maybe correct, I am doing it in the wrong spot (colorClick).  What I was thinking is that I probably have to remember the previously clicked link and unbold that one, but I am unsure of how to do that.</p>