Do not use AlternatingItemTemplate Just to Change Row Color

Very often when using either a DataList or Repeater control, you will see folks using an <AlternatingItemTemplate> template section just to change the background color of every other row. While this is perfectly acceptable, it can become time-consuming , especially if the templated row contains a significant amount of HTML. When it does, you have to ensure that any changes to the HTML in either section (<ItemTemplate> or <AlternatingItemTemplage>) are duplicated except for the background color of the table row of course. If all you are doing is changing the alternating row … [Read more...]