I have a class variable that stores values in the following format:
For Item1,
Action1 = true
Action2 = true
Quantity = 10
For Item2,
Action1 = true
Action2 = FALSE
Quantity = 5
I want to store the values in the above class in the following format.
If Action2 is FALSE, then dont display. ie: Note that Action2 is
missing in line 6 and is replaced with Quantity.
1. Action1 - Item1
2. Action2 - Item1
3. Quantity - 10
4.
5. Action1 - Item2
6. Quantity - 5
What I could think of is - using a repeater control.
So this is what I am using now :
myRepeater.DataSource = myClass.Items
myRepeater.DataBind()
The HTML code is:
<asp:Repeater id="myRepeater" runat="server">
<itemTemplate>
<table>
<tr>
<td>Action1 - <%# DataBinder.Eval(Container.DataItem, "Action1")%>
</td>
<tr>
<td>Action2 - <%# DataBinder.Eval(Container.DataItem, "Action2")%>
</td>
<tr>
<td>Quantity:<%# DataBinder.Eval(Container.DataItem, "quantity")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
But that leaves an empty line after 5. ie between 5 and 6 (as action 2
is empty here.)
Is there anything else I can use ?