Hi makumbi,
Please refer below sample.
HTML
<asp:ListView ID="lvTypes" runat="server" GroupPlaceholderID="GroupPlaceholder1"
ItemPlaceholderID="ItemPlaceholder1">
<LayoutTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<th>Type</th>
<th>Code</th>
</tr>
<asp:PlaceHolder runat="server" ID="GroupPlaceholder1"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="ItemPlaceholder1"></asp:PlaceHolder>
</tr>
</GroupTemplate>
<ItemTemplate>
<td><%# Eval("Type") %></td>
<td><%# Eval("Code") %></td>
</ItemTemplate>
</asp:ListView>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("Type");
dt.Columns.Add("Code");
dt.Rows.Add("ASSETS", "01");
dt.Rows.Add("INCOME", "02");
dt.Rows.Add("EXPENSE", "03");
dt.Rows.Add("LIABILITY", "04");
dt.Rows.Add("PERSONAL - Customers", "05");
dt.Rows.Add("PERSONAL - Suppliers", "06");
lvTypes.DataSource = dt;
lvTypes.DataBind();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As DataTable = New DataTable()
dt.Columns.Add("Type")
dt.Columns.Add("Code")
dt.Rows.Add("ASSETS", "01")
dt.Rows.Add("INCOME", "02")
dt.Rows.Add("EXPENSE", "03")
dt.Rows.Add("LIABILITY", "04")
dt.Rows.Add("PERSONAL - Customers", "05")
dt.Rows.Add("PERSONAL - Suppliers", "06")
lvTypes.DataSource = dt
lvTypes.DataBind()
End If
End Sub