Link to home
Start Free TrialLog in
Avatar of allidap
allidapFlag for United States of America

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.DataItem("Date2")%>' Visible="false"></asp:Label></td>
                     <td><asp:Label ID="LabelDate103" runat="server" Text='<%#Container.DataItem("Date3")%>' Visible="false"></asp:Label></td>
                     <td><asp:Label ID="LabelDate104" runat="server" Text='<%#Container.DataItem("Date4")%>' Visible="false"></asp:Label></td>
                     <td><asp:Label ID="LabelDate105" runat="server" Text='<%#Container.DataItem("Date5")%>' Visible="false"></asp:Label></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

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).
Avatar of allidap

ASKER

In this case, the repeater generates a table in the HTML...

                                            <table id="RepeaterTable">
                                            <tr>
                                                <td>
                                                </td>
                                                <td><span id="RepeaterData_ctl01_LabelDefinition"></span></td>
                                                <td>
                                                </td>
                                                <td>
                                                </td>
                                             ...

How is a data grid control different in accessing the respective table cell?



ASKER CERTIFIED SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of allidap

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.