S
Steve
I am having issues adding a new row in my repeater when my repeater's
table cells reach a certain number. what i'm doing is adding a
predetermined number of color cells from the database and bringing them
into a repeater that is located already inside a table cell which
cannot exceed a certain width.
for example:
ASP:
------------------------------------
<asp:Repeater ID="Repeater1" runat="server"
OnItemDataBound="Repeater1_ItemDataBound">
<HeaderTemplate>
<table id="uiColorTable"><tr>
</HeaderTemplate>
<ItemTemplate>
<td>
<aspanel ID="uiColorSwatch" runat="server" Height="10px"
HorizontalAlign="Center" Width="50px" BackColor='<%#
DataBinder.Eval(Container.DataItem , "ArgbColor") %>'></aspanel>
<asp:Label ID="uiColorName" CssClass="uiColorName" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label>
</td>
</ItemTemplate>
<SeparatorTemplate>
<td> </td>
</SeparatorTemplate>
<FooterTemplate>
</tr></table>
</FooterTemplate>
</asp:Repeater>
C#:
--------------------------------
protected void Repeater1_ItemDataBound(object sender,
RepeaterItemEventArgs e)
{
int x = 0;
foreach (RepeaterItem tmpItem in Repeater1.Items)
{
if (x == 8)
{
LiteralControl tmpLiteral = new
LiteralControl("</td></tr><tr><td>");
Repeater1.Controls.Add(tmpLiteral);
x = 0;
}
else
{
x++;
}
}
}
to be honest, i have a feeling i'm not doing something retardedly
simple but after staring at this for a few hours, i'm starting to get
crosseyed. some help would be awesome!
table cells reach a certain number. what i'm doing is adding a
predetermined number of color cells from the database and bringing them
into a repeater that is located already inside a table cell which
cannot exceed a certain width.
for example:
ASP:
------------------------------------
<asp:Repeater ID="Repeater1" runat="server"
OnItemDataBound="Repeater1_ItemDataBound">
<HeaderTemplate>
<table id="uiColorTable"><tr>
</HeaderTemplate>
<ItemTemplate>
<td>
<aspanel ID="uiColorSwatch" runat="server" Height="10px"
HorizontalAlign="Center" Width="50px" BackColor='<%#
DataBinder.Eval(Container.DataItem , "ArgbColor") %>'></aspanel>
<asp:Label ID="uiColorName" CssClass="uiColorName" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label>
</td>
</ItemTemplate>
<SeparatorTemplate>
<td> </td>
</SeparatorTemplate>
<FooterTemplate>
</tr></table>
</FooterTemplate>
</asp:Repeater>
C#:
--------------------------------
protected void Repeater1_ItemDataBound(object sender,
RepeaterItemEventArgs e)
{
int x = 0;
foreach (RepeaterItem tmpItem in Repeater1.Items)
{
if (x == 8)
{
LiteralControl tmpLiteral = new
LiteralControl("</td></tr><tr><td>");
Repeater1.Controls.Add(tmpLiteral);
x = 0;
}
else
{
x++;
}
}
}
to be honest, i have a feeling i'm not doing something retardedly
simple but after staring at this for a few hours, i'm starting to get
crosseyed. some help would be awesome!