allidap
asked on
Reference repeater table cell
Greetings!
I've been trying, without success, to figure out how to reference a repeaters' table cell.
Basically, I've the repeater included below. As the date values get entered, the background color needs to be changed depending upon elapsed time. Basic colors are red, yellow and green. Changing the label background and foreground colors are the problem. The problem is changing the container table cell background color to match the respective cells' label background color. This is the requirement that I've been presented and I've been, without success, trying to figure out.
Looks like the label parent is the repeater. Is there any way to get the cell containing the label?
Thanks!
Allidap
<asp:Repeater ID="RepeaterData" runat="server">
<HeaderTemplate>
<table id="RepeaterTable">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:Label ID="LabelDate102" runat="server" Text='<%#Container.DataIte m("Date2") %>' Visible="false"></asp:Labe l></td>
<td><asp:Label ID="LabelDate103" runat="server" Text='<%#Container.DataIte m("Date3") %>' Visible="false"></asp:Labe l></td>
<td><asp:Label ID="LabelDate104" runat="server" Text='<%#Container.DataIte m("Date4") %>' Visible="false"></asp:Labe l></td>
<td><asp:Label ID="LabelDate105" runat="server" Text='<%#Container.DataIte m("Date5") %>' Visible="false"></asp:Labe l></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
I've been trying, without success, to figure out how to reference a repeaters' table cell.
Basically, I've the repeater included below. As the date values get entered, the background color needs to be changed depending upon elapsed time. Basic colors are red, yellow and green. Changing the label background and foreground colors are the problem. The problem is changing the container table cell background color to match the respective cells' label background color. This is the requirement that I've been presented and I've been, without success, trying to figure out.
Looks like the label parent is the repeater. Is there any way to get the cell containing the label?
Thanks!
Allidap
<asp:Repeater ID="RepeaterData" runat="server">
<HeaderTemplate>
<table id="RepeaterTable">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:Label ID="LabelDate102" runat="server" Text='<%#Container.DataIte
<td><asp:Label ID="LabelDate103" runat="server" Text='<%#Container.DataIte
<td><asp:Label ID="LabelDate104" runat="server" Text='<%#Container.DataIte
<td><asp:Label ID="LabelDate105" runat="server" Text='<%#Container.DataIte
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
Repeaters will output any html you specify. This doesn't have to be a table. This means that as far as the repeater is concerned, there's no such thing as a cell. If you really want programmatic access to cells you're probably better off using one of the grid controls (there are at least three different grid controls included with .Net).
ASKER
In this case, the repeater generates a table in the HTML...
<table id="RepeaterTable">
<tr>
<td>
</td>
<td><span id="RepeaterData_ctl01_Lab elDefiniti on"></span ></td>
<td>
</td>
<td>
</td>
...
How is a data grid control different in accessing the respective table cell?
<table id="RepeaterTable">
<tr>
<td>
</td>
<td><span id="RepeaterData_ctl01_Lab
<td>
</td>
<td>
</td>
...
How is a data grid control different in accessing the respective table cell?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found a solution that allows accessing a repeater table cell. It utilizes htmltablecell; e.g.,
dim td as htmltablecell
td = ctype(ritem.findcontrol(". .."), htmltablecell)
with this, you have complete control to all of the cell attributes.
dim td as htmltablecell
td = ctype(ritem.findcontrol(".
with this, you have complete control to all of the cell attributes.