Starting with Asp.net 4.5 web controls can take advantage from strongly-typed binding to get IntelliSense support and compiletime errors.
Create a class, which holds your model:
public class Album
{
public int Id { get; set; }
public string Name { get; set; }
public string Artist { get; set; }
}
Define the GridView control on your page:
<asp:GridView ID="Grid" runat="server" AutoGenerateColumns="false" ItemType="YourNamespace.Album">
<Columns>
<asp:TemplateField HeaderText="Id">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text="<%# Item.Id %>"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text="<%# Item.Name %>"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Artist">
<ItemTemplate>
<asp:Label ID="lblCity" runat="server" Text="<%# Item.Artist %>"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Load the data and bind it:
var albumList = new List<Album>
{
new Album {Id = 1, Artist = "Icing (a Cake cover band)", Name = "Toppings Vol. 1"},
new Album {Id = 2, Artist = "Fleetwood PC", Name = "Best of Windows"},
new Album {Id = 3, Artist = "this.Bandnames", Name = "TH_ (Pronounced \"Thunderscore\")"},
};
Grid.DataSource = albumList;
Grid.DataBind();