ASP.NET - Problema ListView y GroupItemCount

 
Vista:

Problema ListView y GroupItemCount

Publicado por Cruisin (5 intervenciones) el 12/02/2015 00:55:11
Hola.

Tengo un listview que muestra los productos, también un datapager, al listview le puse su GroupItemCount a 2 para que muestre los productos en dos columnas, en la primera pagina funciona bien, salen 4 productos de la siguiente manera...

Articulo1 Articulo2
Articulo3 Articulo4

el problema es cuando paso a la siguiente pagina, que de momento es la ultima y la lista sale...

Articulo5
Articulo6

lo que yo quiero es que salga....

Articulo5 Articulo6

es decir, en horizontal no en vertical, no se que es lo que esta mal, si alguien puede ayudarme estaría muy agradecido, ya que solo me falta ese pequeño detalle para terminar esa pagina, gracias y un saludo a todos.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Problema ListView y GroupItemCount

Publicado por Khristian (335 intervenciones) el 12/02/2015 03:52:10
Seguro que la primera pagina sale así:

Articulo1 Articulo2
Articulo3 Articulo4


No estará saliendo así:

Articulo1 Articulo3
Articulo2 Articulo4

Si es así.... ya sabrás buscar la respuesta.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Problema ListView y GroupItemCount

Publicado por Cruisin (5 intervenciones) el 12/02/2015 23:23:05
Hola, gracias por responder.

Si sale como escribi, de tal manera...

Articulo1 Articulo2
Articulo3 Articulo4

Lo que no puse anteriormente fue que en la tabla tengo dos tipos de artículos, los que están de alta y los que están de baja, el select solo coge los que están de alta, lo que tampoco debería ser un problema para que salieran bien ordenados en el Listview.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Problema ListView y GroupItemCount

Publicado por Khristian (335 intervenciones) el 13/02/2015 04:55:54
Articulo1 Articulo2
Articulo3 Articulo4

Respetan el orden de resultado de tu consulta???

O sea, cuando los señalas así, se asume que estas ejemplificando el orden real de ese resultado, que Articulo1 es el que debe salir primer, luego le sigue Articulo2, etc....

Es importante ejemplificar con información coherente, por ejemplo, si tengo

ID 1 Articulo4
ID 2 Articulo2
ID 3 Articulo1
ID 4 Articulo3

Y tu consulta va ordenada por ID, el resultado seria Articulo4, Articulo2, Articulo1, Articulo3

Es importante que des toda la información suficiente, como tu consulta sql, tu configuración del listview, capturas, etc.

Por que lo anterior?.... pues como has mostrado el resultado de tu segunda pagina, pareciera que tu flujo es: De arriba hacia abajo, luego siguiente columna a la derecha, y repite de arriba abajo.

Como que no cuadra que en la primera pagina sea: Esquina superior izquierda, a la derecha; luego bajar una fila, comenzar de nuevo de la izquerda, hacia la derecha, etc,. (Lectura occidental)

De todas formas te dejo esto por si te sirve: http://panicoenlaxbox.blogspot.com/2011/10/control-listview-en-aspnet.html

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Problema ListView y GroupItemCount

Publicado por Cruisin (5 intervenciones) el 15/02/2015 23:22:22
Hola de nuevo, copio el código del SQLdataSource y del Listview por si lo ves mas claro asi, he probado modificando el select y que lo ordene por el id, pero el resultado es el mismo.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"
        DeleteCommand="DELETE FROM [Car_Productos] WHERE [ProductoID] = @ProductoID"
        InsertCommand="INSERT INTO [Car_Productos] ([Titulo], [Descripcion], [CategoriaID], [Precio], [Oferta], [Imagen], [EsPromocion], [Stock], [Baja], [VecesVisto], [VecesComprado], [FechaAlta]) VALUES (@Titulo, @Descripcion, @CategoriaID, @Precio, @Oferta, @Imagen, @EsPromocion, @Stock, @Baja, @VecesVisto, @VecesComprado, @FechaAlta)"
        ProviderName="<%$ ConnectionStrings:LocalSqlServer.ProviderName %>"
        SelectCommand="SELECT [ProductoID], [Titulo], [Descripcion], [CategoriaID], [Precio], [Oferta], [Imagen], [EsPromocion], [Stock], [Baja], [VecesVisto], [VecesComprado], [FechaAlta] FROM [Car_Productos] WHERE [Baja] ='0'"
        UpdateCommand="UPDATE [Car_Productos] SET [Titulo] = @Titulo, [Descripcion] = @Descripcion, [CategoriaID] = @CategoriaID, [Precio] = @Precio, [Oferta] = @Oferta, [Imagen] = @Imagen, [EsPromocion] = @EsPromocion, [Stock] = @Stock, [Baja] = @Baja, [VecesVisto] = @VecesVisto, [VecesComprado] = @VecesComprado, [FechaAlta] = @FechaAlta WHERE [ProductoID] = @ProductoID">
        <DeleteParameters>
            <asp:Parameter Name="ProductoID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Titulo" Type="String" />
            <asp:Parameter Name="Descripcion" Type="String" />
            <asp:Parameter Name="CategoriaID" Type="Int32" />
            <asp:Parameter Name="Precio" Type="Decimal" />
            <asp:Parameter Name="Oferta" Type="Decimal" />
            <asp:Parameter Name="Imagen" Type="String" />
            <asp:Parameter Name="EsPromocion" Type="Boolean" />
            <asp:Parameter Name="Stock" Type="Decimal" />
            <asp:Parameter Name="Baja" Type="Boolean" />
            <asp:Parameter Name="VecesVisto" Type="Int32" />
            <asp:Parameter Name="VecesComprado" Type="Int32" />
            <asp:Parameter DbType="Date" Name="FechaAlta" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Titulo" Type="String" />
            <asp:Parameter Name="Descripcion" Type="String" />
            <asp:Parameter Name="CategoriaID" Type="Int32" />
            <asp:Parameter Name="Precio" Type="Decimal" />
            <asp:Parameter Name="Oferta" Type="Decimal" />
            <asp:Parameter Name="Imagen" Type="String" />
            <asp:Parameter Name="EsPromocion" Type="Boolean" />
            <asp:Parameter Name="Stock" Type="Decimal" />
            <asp:Parameter Name="Baja" Type="Boolean" />
            <asp:Parameter Name="VecesVisto" Type="Int32" />
            <asp:Parameter Name="VecesComprado" Type="Int32" />
            <asp:Parameter DbType="Date" Name="FechaAlta" />
            <asp:Parameter Name="ProductoID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:Label ID="Label1" runat="server" Text="<h1><strong>Productos</strong></h1>"></asp:Label>
    <br />
    <br />
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ProductoID"
        DataSourceID="SqlDataSource1" EnableModelValidation="True" GroupItemCount="2">
        <AlternatingItemTemplate>
        <div id="left">
        <div class="prueba"><asp:ImageButton ID="ImageButton2" runat="server" Height="150px" Width="150px" ImageUrl='<%# Eval("Imagen", "~/Carrito/Imagenes/{0}") %>' PostBackUrl='<%# Eval("ProductoID", "~/Carrito/Detalles.aspx?ProductoID={0}") %>' CommandName="Ver"/><br /></DIV>
  <div class="info"><asp:Label ID="lblProductoID" runat="server"
                    Text='<%# Eval("ProductoID") %>' Visible="false"/>
                    <br />CategoriaID:
                <asp:Label ID="CategoriaIDLabel" runat="server"
                    Text='<%# Eval("CategoriaID") %>' />
                <br />Titulo:
                <asp:Label ID="lblTitulo" runat="server" Text='<%# Eval("Titulo") %>' />
                <br />Descripcion:
                <asp:Label ID="DescripcionLabel" runat="server"
                    Text='<%# IrDescripcion(Eval("Descripcion")) %>' />
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Carrito/Iconos/mas3.png" PostBackUrl='<%# Eval("ProductoID", "Detalles.aspx?ProductoID={0}") %>' ToolTip="Leer más..." CommandArgument='<%# Eval("ProductoID") %>' CommandName="Leermas"/>                                 
   <div class="price">Precio:
                <asp:Label ID="lblPrecio" runat="server" Text='<%# Eval("Precio", "{0:C}") %>' />&nbsp;<asp:Label ID="lblOferta" runat="server" Text='<%# Eval("Oferta", "{0:C}") %>' />&nbsp;<asp:Label
                    ID="lblPortentaje" runat="server" Text=""></asp:Label>
                                 </DIV>
  <div class="actions">Cantidad:&nbsp;<asp:TextBox ID="txtCantidad" runat="server" Text="1" MaxLength="3" Width="25px"></asp:TextBox><asp:ImageButton
                    ID="ImageButton3" runat="server" imageurl="~/Carrito/Iconos/Carro.png" CommandName="Agregar" CssClass="carro"/></DIV>
  <br />
                <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# "~/Administrador/Carrito/Entrada.aspx?ProductoID=" & Eval("ProductoID") %>' Visible="false">Editar</asp:HyperLink>
                <asp:Label ID="lblSeparador1" runat="server" Text=" | " Visible="false"></asp:Label>
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Delete" Text="Eliminar" OnClientClick="return confirm('La entrada sera eliminada de forma permannte. ¿Desea borrarla?');" Visible="false"/>
                <asp:Label ID="lblSeparador2" runat="server" Text=" | " Visible="false"></asp:Label>
                <asp:LinkButton ID="LinkButton5" runat="server" OnClick="LinkButton1_Click" Text="Insertar" Visible="false"/></DIV></DIV>
        </AlternatingItemTemplate>
        <EditItemTemplate>
 
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table id="Table1" runat="server" style="">
                <tr>
                    <td>
                        No se han devuelto datos.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td id="Td1" runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
 
        </InsertItemTemplate>
        <ItemTemplate>
        <div id="left">
            <div class="prueba"><asp:ImageButton ID="ImageButton2" runat="server" Height="150px" Width="150px" ImageUrl='<%# Eval("Imagen", "~/Carrito/Imagenes/{0}") %>' PostBackUrl='<%# Eval("ProductoID", "Detalles.aspx?ProductoID={0}") %>' CommandName="Ver"/><br /></DIV>
  <div class="info"><asp:Label ID="lblProductoID" runat="server"
                    Text='<%# Eval("ProductoID") %>' Visible="false" />
                    <br />CategoriaID:
                <asp:Label ID="CategoriaIDLabel" runat="server"
                    Text='<%# Eval("CategoriaID") %>' />
                <br />Titulo:
                <asp:Label ID="lblTitulo" runat="server" Text='<%# Eval("Titulo") %>' />
                <br />Descripcion:
                <asp:Label ID="DescripcionLabel" runat="server"
                    Text='<%# IrDescripcion(Eval("Descripcion")) %>' />
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Carrito/Iconos/mas3.png" PostBackUrl='<%# Eval("ProductoID", "Detalles.aspx?ProductoID={0}") %>' ToolTip="Leer más..." CommandArgument='<%# Eval("ProductoID") %>' CommandName="Leermas"/>                                                               
   <div class="price">Precio:
                <asp:Label ID="lblPrecio" runat="server" Text='<%# Eval("Precio", "{0:C}") %>' />&nbsp;<asp:Label ID="lblOferta" runat="server" Text='<%# Eval("Oferta", "{0:C}") %>' />&nbsp;<asp:Label
                    ID="lblPortentaje" runat="server" Text=""></asp:Label>
                                 </DIV>
  <div class="actions">Cantidad:&nbsp;<asp:TextBox ID="txtCantidad" runat="server" Text="1" MaxLength="3" Width="25px"></asp:TextBox><asp:ImageButton
                    ID="ImageButton3" runat="server" imageurl="~/Carrito/Iconos/Carro.png" CommandName="Agregar" CssClass="carro"/><br /></DIV>
   <br />
                <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# "~/Administrador/Carrito/Entrada.aspx?ProductoID=" & Eval("ProductoID") %>' Visible="false">Editar</asp:HyperLink>
                <asp:Label ID="lblSeparador1" runat="server" Text=" | " Visible="false"></asp:Label>
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Delete" Text="Eliminar" OnClientClick="return confirm('La entrada sera eliminada de forma permannte. ¿Desea borrarla?');" Visible="false"/>
                <asp:Label ID="lblSeparador2" runat="server" Text=" | " Visible="false"></asp:Label>
                <asp:LinkButton ID="LinkButton5" runat="server" OnClick="LinkButton1_Click" Text="Insertar" Visible="false"/></DIV></DIV>
        </ItemTemplate>
        <LayoutTemplate>
            <table id="Table2" runat="server">
                <tr id="Tr1" runat="server">
                    <td id="Td2" runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr id="Tr2" runat="server">
                    <td id="Td3" runat="server" style="">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="4">
                            <Fields>
                      <asp:NextPreviousPagerField ShowNextPageButton="False" ButtonCssClass="previousNextLink" ButtonType="Link" ShowFirstPageButton="True" />
 
            <asp:NumericPagerField ButtonCount="5" ButtonType="Link" NumericButtonCssClass="numericLink" />
 
            <asp:NextPreviousPagerField ShowPreviousPageButton="False" ButtonCssClass="previousNextLink" ButtonType="Link" ShowLastPageButton="True"/>
                    </Fields>
 
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td id="Td4" runat="server" style="">
                ProductoID:
                <asp:Label ID="ProductoIDLabel" runat="server"
                    Text='<%# Eval("ProductoID") %>' />
                <br />Titulo:
                <asp:Label ID="TituloLabel" runat="server" Text='<%# Eval("Titulo") %>' />
                <br />Descripcion:
                <asp:Label ID="DescripcionLabel" runat="server"
                    Text='<%# Eval("Descripcion") %>' />
                <br />CategoriaID:
                <asp:Label ID="CategoriaIDLabel" runat="server"
                    Text='<%# Eval("CategoriaID") %>' />
                <br />Precio:
                <asp:Label ID="PrecioLabel" runat="server" Text='<%# Eval("Precio") %>' />
                <br />Oferta:
                <asp:Label ID="OfertaLabel" runat="server" Text='<%# Eval("Oferta") %>' />
                <br />Imagen:
                <asp:Label ID="ImagenLabel" runat="server" Text='<%# Eval("Imagen") %>' />
                <br />Stock:
                <asp:Label ID="StockLabel" runat="server" Text='<%# Eval("Stock") %>' />
                <br />
                <asp:CheckBox ID="BajaCheckBox" runat="server" Checked='<%# Eval("Baja") %>' 
                    Enabled="false" Text="Baja" />
                <br />
            </td>
        </SelectedItemTemplate>
    </asp:ListView>

Espero que veas el error, yo no lo encuentro, te agradezco el enlace que pusistes, pero además de ese ya he revisado muchimos mas antes de escribir en el foro, ya que el ListView es un control que he aprendido a usar yo solo con ayuda de tutoriales y artículos que encontré por internet, gracias y un saludo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar