Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving to Next Record 1

Status
Not open for further replies.

asafb

Programmer
Jun 17, 2003
80
US
Hello, I'm using the Repeater control to display pictures from a SQL database. Now I'd like to format it in a neat grid table. Right now, it's displaying this:

pictures are the x's:

x x x x x x x

i want it to look like this:

x x x x
x x x x
x x x x

Problem is, it doesn't go to the next record, so what is the command for next record? I'm trying to accomplish this:

Any help thank you very very much!!!!

*************
ASP.NET Code
************

<%@ Page Language="vb" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">

Sub Page_Load(sender As Object, e As EventArgs)
' Create a connection to the "pubs" SQL database located
' on the local computer.
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
' Connect to the SQL database using a SQL SELECT query to get
' all the data from the "Titles" table.
myConnection = New SqlConnection("server=24.136.102.162;" _
& "database=usedpianos;user id=sa;pwd=XXXXXXXX")
myCommand = New SqlDataAdapter("SELECT * FROM data", _
myConnection)
' Create and fill a DataSet.
Dim ds As Dataset = new DataSet()
myCommand.Fill(ds)
' Bind MyRepeater to the DataSet. MyRepeater is the ID of the
' Repeater control in the HTML section of the page.
MyRepeater.DataSource = ds
MyRepeater.DataBind()
End SUb

</script>
<html>
<head>
</head>
<body>
<asp:Repeater id="myrepeater" runat="server">
<itemtemplate>
<img src="<%# DataBinder.Eval(Container.DataItem, "gridpix") %>">
</itemtemplate>
</asp:Repeater>
</body>
</html>
 
If you used a datalist you could set the repeatcolumns to 4 and the repeatDirection to vertical.

 
Thanks stsuing. That's a valuable property of the DataList, among others, great use of it here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top