Il primo problema l'ho risolto cosi
<script runat="server">
Dim NRecord As Integer
Dim NColonne As Integer
Dim Verifica As String
Dim VerificaColonne As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
NColonne = 5
NRecord = 1
Verifica = "NO"
ltvElencoPartners.DataBind()
End Sub
Protected Sub ltvElencoPartners_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ltvElencoPartners.ItemDataBound
If (e.Item.ItemType = ListViewItemType.DataItem) Then
Dim plc As PlaceHolder = DirectCast(e.Item.FindControl("itemPlaceHolder"), PlaceHolder)
Dim di As Data.DataRowView = e.Item.DataItem()
Dim Tabella As New Literal
Dim TabellaTemp As New Literal
If NRecord = NColonne Then
Tabella.Text = "</tr><tr><td><table width=""1%"" height=""1%"" border=""0px"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr><td><table width=""152px"" height=""152px"" border=""0px"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""box""><tr><td valign=""middle"" align=""center"" style=""background:url(../../images/sistema/cerchio_grigio.png) no-repeat;""><div class=""testo""><a href=""#"" style=""font-weight:normal;""><span class=""testomediocerchio"">" & NRecord & "<br>" & DirectCast(e.Item.DataItem, DataRowView).Row(0).ToString() & "</span></a></div><div class=""logo"" style=""display:none;""><a href=""#""><img src=""" & DirectCast(e.Item.DataItem, DataRowView).Row(1).ToString() & """ width=""130px"" border=""0"" /></a></div></td></tr></table></td>"
If Verifica = "OK" Then
NColonne = NColonne + 4
Verifica = "NO"
TabellaTemp.Text = "</tr></table></td>"
plc.Controls.Add(TabellaTemp)
Else
NColonne = NColonne + 5
Verifica = "OK"
TabellaTemp.Text = "</tr></table></td>"
plc.Controls.Add(TabellaTemp)
End If
Else
If Verifica <> "OK" Then
If VerificaColonne = "" Then
TabellaTemp.Text = "<td><table width=""1%"" height=""1%"" border=""0px"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr>"
plc.Controls.Add(TabellaTemp)
VerificaColonne = "NO"
End If
End If
Tabella.Text = "<td><table width=""152px"" height=""152px"" border=""0px"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""box""><tr><td valign=""middle"" align=""center"" style=""background:url(../../images/sistema/cerchio_grigio.png) no-repeat;""><div class=""testo""><a href=""#"" style=""font-weight:normal;""><span class=""testomediocerchio"">" & NRecord & "<br>" & DirectCast(e.Item.DataItem, DataRowView).Row(0).ToString() & "</span></a></div><div class=""logo"" style=""display:none;""><a href=""#""><img src=""" & DirectCast(e.Item.DataItem, DataRowView).Row(1).ToString() & """ width=""130px"" border=""0"" /></a></div></td></tr></table></td>"
End If
plc.Controls.Add(Tabella)
NRecord = NRecord + 1
End If
End Sub
</script>
<table width="100%" height="100%" border="0px" align="center" cellpadding="13" cellspacing="0">
<tr>
<td valign="middle" align="center"><span class="titolograndegrigio">A higher plain</span></td>
</tr>
<tr>
<td valign="top" align="center">
<table width="77%" border="0px" align="center" cellpadding="0" cellspacing="0">
<tr>
<asp:ListView runat="server" ID="ltvElencoPartners" DataSourceID="SqlDataSourceElencoPartners">
<ItemTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
</ItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSourceElencoPartners" runat="server" ConnectionString="<%$ ConnectionStrings:ReadConnectionString %>" SelectCommand="SELECT Nome, Logo FROM [Partners_ENG] ORDER BY NEWID()"></asp:SqlDataSource>
</tr>
</table>
</td>
</tr>
</table>
Sicuramente non è una bella soluzione!!!
Voi che ne dite? C'erano altre soluzione più pulite?
Grazie
Tommaso