RadhaKrishnaKiJaya
asked on
How to repeat the data
Hi Experts,
I have the startdate and the enddate. While the startdate is < the end date I have to display the data in the format which I have attached.
All the mealtypes are coming from the database. It is ASP.net and VB.Net
Please help.
Thanks in advance.
screen.png
I have the startdate and the enddate. While the startdate is < the end date I have to display the data in the format which I have attached.
All the mealtypes are coming from the database. It is ASP.net and VB.Net
Please help.
Thanks in advance.
screen.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Kyle,
Thank u so much for your reply. Actually the date in the header is not coming from database. The Meal type and Meal ID are in a dataset. Do I need to create another datatable putting everything together and then bind it to the repeater control or is there any easy way to do it?
Thanks a lot.
Thank u so much for your reply. Actually the date in the header is not coming from database. The Meal type and Meal ID are in a dataset. Do I need to create another datatable putting everything together and then bind it to the repeater control or is there any easy way to do it?
Thanks a lot.
ASKER
Finally I found a way to do it. I am using nested repeater control. I am collecting all the dates in a dataset and binding that to the outer repeater control and for each row of outer control I am populating the inner repeater control. I got the idea from your code. so thank you very much.
<table>
<asp:Repeater ID="outerRepeater" runat="server" EnableViewState="true">
<ItemTemplate>
<tr>
<th>
<asp:Label ID="lblStartDate" runat="server" Text='<%#Eval("StartDate") %>'></asp: Label>
</th>
</tr>
<asp:Repeater ID="innerRepeater" runat="server" EnableViewState="true">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblMealTypeID" runat="server" Text='<%#Eval("MealID")%>' ItemStyle-HorizontalAlign= "Center" visible="false"></asp:Labe l>
<asp:label ID="lblMealTypeName" runat="server" Text='<%#Eval("MealType")% >' ItemStyle-HorizontalAlign= "Center">< /asp:label >
</td>
<td>
<asp:DropDownList ID="ddlMenu1" runat="server"></asp:DropD ownList>
</td>
<td>
<asp:DropDownList ID="ddlMenu2" runat="server"></asp:DropD ownList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</table>
<table>
<asp:Repeater ID="outerRepeater" runat="server" EnableViewState="true">
<ItemTemplate>
<tr>
<th>
<asp:Label ID="lblStartDate" runat="server" Text='<%#Eval("StartDate")
</th>
</tr>
<asp:Repeater ID="innerRepeater" runat="server" EnableViewState="true">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblMealTypeID" runat="server" Text='<%#Eval("MealID")%>'
<asp:label ID="lblMealTypeName" runat="server" Text='<%#Eval("MealType")%
</td>
<td>
<asp:DropDownList ID="ddlMenu1" runat="server"></asp:DropD
</td>
<td>
<asp:DropDownList ID="ddlMenu2" runat="server"></asp:DropD
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</table>
Is calculating dates your problem?