完全なコードを表示しなかったため、これを全ページにどのように表示しているかわかりません。リピーター、グリッドビュー、リストビュー、またはカスタム表示コンテナーを使用できます。
以下は、ListViewを使用してそれを行う方法の例です。
Default.aspx:
<asp:ListView ID="lvData" runat="server" ItemPlaceholderID="phItem" OnItemDataBound="lvData_ItemDataBound">
<LayoutTemplate>
<table>
<thead>
<tr>
<th>Fullname</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder ID="phItem" runat="server" />
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td><asp:Literal ID="litFullname" runat="server" /></td>
</tr>
</ItemTemplate>
</asp:ListView>
Default.aspx.cs
protected void lvData_ItemDataBound(object sender, ListViewItemEventArgs e)
{
//Get the data item that was passed in, in this case which number for this row.
var data = (int)e.Item.DataItem;
//Create temp first and last names
var firstName = "First" + data.ToString();
var lastName = "Last" + data.ToString();
//Display it to the listview
var litFullname = (Literal)e.Item.FindControl("litFullname");
litFullname.Text = string.Format("{0} {1}", firstName, lastName);
}