flextable.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace = "System.Data" %>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim myDataTable As DataTable
Dim myDataRow As DataRow
Dim I As Integer
' Make up some sample data to display. I'm using an in-memory
' DataTable to keep things fast and because I assume most users
' will be using script with some sort of database. This way you
' should just be able to drop in your own DB code and edit the
' display section and you should have everything working.
myDataTable = New DataTable
myDataTable.Columns.Add("id", Type.GetType("System.Int32"))
myDataTable.Columns.Add("title", Type.GetType("System.String"))
myDataTable.Columns.Add("description", Type.GetType("System.String"))
myDataTable.Columns.Add("image", Type.GetType("System.String"))
For I = Asc("A") To Asc("Z")
myDataRow = myDataTable.NewRow()
myDataRow("id") = I - 64
myDataRow("title") = "The Letter " & Chr(I)
myDataRow("description") = "This is an image of an upper case " & Chr(I) & "."
myDataRow("image") = "images/lb_" & Chr(I) & ".gif"
myDataTable.Rows.Add(myDataRow)
Next I
' Set repeat columns and direction.
myDataList.RepeatColumns = ddlWidth.SelectedItem.Value
myDataList.RepeatDirection = RepeatDirection.Horizontal
' Bind the DataTable to our DataList
myDataList.DataSource = myDataTable
myDataList.DataBind()
End Sub
</script>
<html>
<head>
<title>ASP.NET FlexTable Sample</title>
</head>
<body>
<form runat="server" EnableViewState="False">
<asp:DataList id="myDataList" runat="server"
Border = "3"
>
<ItemTemplate>
<strong><%# DataBinder.Eval(Container.DataItem, "title") %></strong><br />
<img src="<%# DataBinder.Eval(Container.DataItem, "image") %>" align="right">
<%# DataBinder.Eval(Container.DataItem, "description") %>
</ItemTemplate>
</asp:DataList>
<p>
Width:
<asp:DropDownList id="ddlWidth" runat="server" AutoPostBack="True">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem Selected="True">4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
<asp:ListItem>8</asp:ListItem>
<asp:ListItem>9</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
</asp:DropDownList>
</p>
</form>
<hr />
<p>
Click <a href="http://www.asp101.com/samples/flextable_aspx.asp">here</a>
to read about and download the source code.
</p>
</body>
</html>