ASP.NET - Consulta DataList

 
Vista:

Consulta DataList

Publicado por Raul (6 intervenciones) el 12/08/2008 17:48:35
Hola, se puede mostrar datos agrupados por un campo en un DataList, algo asi?

Dia Lunes:
10:00 am Inaguracion
10:30 am Inicio de Taller
11:30 am Breack
12:30 am Continuacion
01:30 pm Almuerzo

Dia Martes:
10:00 am Tema 1
10:30 am Tema 2
11:30 am Breack
12:30 am Tema 3
01:30 pm Almuerzo

Dia Miercoles:
10:00 am Tema 4
10:30 am Tema 5
11:30 am Breack
12:30 am Tema 6
01:30 pm Clausura

Agradecere mucho su ayuda ya que hasta ahora no encuentro algo claro intente intente pero na hasta ahora, tambien quisiera saber si en el Headertemplate puedo usar
DataBinder.Eval(Container.DataItem,"Campo")

En realidada es mostrar cabecera detalle.

Gracias.
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
sin imagen de perfil

RE:Consulta DataList

Publicado por @vm (196 intervenciones) el 12/08/2008 19:42:15
Puedes intentar hacer algo como esto:

<asp:Panel ID="Panel1" GroupingText="Ejemplo: DataList Anidado" runat="server">
<asp:DataList ID="dtlCategorias" DataKeyField="CategoryID" DataSourceID="SqlDSCategorias" runat="server">
<ItemTemplate>
<asp:Label ID="lblCatID" Text='<%# Eval("CategoryID") %>' Font-Bold="true" runat="server"></asp:Label>
<asp:Label ID="Label1" Text=":" Font-Bold="true" runat="server"></asp:Label>
<asp:Label ID="lblCatName" Text='<%# Eval("CategoryName") %>' runat="server"></asp:Label>
<table>
<tr>
<td style="width: 3%;"> </td>
<td>
<asp:DataList ID="dtlProductos" DataKeyField="ProductID" DataSourceID="SqlDSProductos" runat="server">
<ItemTemplate>
<asp:Label ID="lblProdID" Text='<%# Eval("ProductID") %>' Font-Bold="true" runat="server"></asp:Label>
<asp:Label ID="Label2" Text=":" Font-Bold="true" runat="server"></asp:Label>
<asp:Label ID="lblProdName" Text='<%# Eval("ProductName") + " - " %>' runat="server"></asp:Label>
<asp:Label ID="lblCatName" Text='<%# Eval("CategoryName") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDSProductos" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName], [CategoryName] FROM [Alphabetical list of products] WHERE ([CategoryID] = @CategoryID)">
<SelectParameters>
<asp:ControlParameter ControlID="lblCatID" Name="CategoryID" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDSCategorias" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]"></asp:SqlDataSource>
</asp:Panel>
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