Problemi con la formattazione del TABLE

martedì 29 agosto 2006 - 17.30

galassya Profilo | Newbie

Prima con ASP faceco questo:

<table>
<tr>

<td width="90">
<%=RSum("uni1")%></td>
<% if RSum("uni2") <> "" then %>
<td><%=RSum("uni2")%></td>
<% End If %>
<% if RSum("uni3") <> "" then %>
<td><%=RSum("uni3")%></td>
<% End If %>
<% if RSum("uni4") <> "" then %>
<td><%=RSum("uni4")%></td>
<% End If %>

</tr>
<%
If not RSart.EOF And not RSart.BOF Then
while not RSart.EOF

%> <tr bgcolor="#FFFFEC">
<td><%=RSart("codart")%></td>
<% if RSart("unita1") <> "" then %>
<td><%=RSart("unita1")%></td>
<% End If %>
<% if RSart("unita2") <> "" then %>
<td><%=RSart("unita2")%></td>
<% End If %>
<% if RSart("unita3") <> "" then %>
<td><%=RSart("unita3")%></td>
<% End If %>

</tr>
<%
RSart.MoveNext

Wend
RSum.close
Set RSum = Nothing
RSart.Close
Set RSart = Nothing

end if
%>
</table>


Ora il problema di vedere o non vedere o no le <TD> ho fatto cosi
per la prima riga

If myDettaglioUnita.Uni11 <> Nothing Then

Uni11.Text = "<td>" & myDettaglioUnita.Uni11 & "</td>"

Else

Uni11.Visible = False

End If

cosi se la cella ha il record lo vedo altrimenti picche



poi il problema mi si porta nella formazione della tabella

<table>
<tr>
<asp:label id="Uni1" runat="server"></asp:label>
<asp:label id="Uni2" runat="server"></asp:label>
<asp:label id="Uni3" runat="server"></asp:label>
<asp:label id="Uni4" runat="server"></asp:label>
</tr>


<asp:DataList id="MyList" RepeatColumns="1" runat="server">
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem, "Codice") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "Unita1") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "Unita2") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "Unita3") %></td>

</tr>
</ItemTemplate>
</asp:DataList></table>

un casino mai visto
TR che non si vedono e

ora... la mia domanda era:
come riesco a fare una table come avevo con il vecchio ASP???





GvnnRules Profilo | Senior Member

Sbagli oggetto, l'oggetto giusto per questo lavoro è il repeater, il datalist intabella di già le righe, per quello che il risultato è un casino

Peace
Gvnn

http://www.gvnn.it
http://www.sqlwebarchitect.org
http://blogs.dotnethell.it/gvnn/

galassya Profilo | Newbie

infatti dopo un po ho capito che repeater faceva al caso mio.

rimane comunque il problema che ho due tr diverse una con una riga e l'altra con le varie righe, questo perche i articoli hanno degli header diversi uno dall'altro

secondo te come risolvo questo??

GvnnRules Profilo | Senior Member

Quà andiamo sul difficile ... potresti mettere nell'item tutti e due i tr, però definisci i tr come runat server

<tr id="tr1" runat="Server">
...
</tr>
<tr id="tr2" runat="Server">
...
</tr>

e poi da codebehind nascondi o visualizzi la tr che ti interessa, facendo un findControl e impostando la proprietà visible

.... dovrebbe funzionare

Peace
Gvnn

http://www.gvnn.it
http://www.sqlwebarchitect.org
http://blogs.dotnethell.it/gvnn/
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5