Reference repeater table cell


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?


<asp:Repeater ID="RepeaterData" runat="server">
<table id="RepeaterTable">
      <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>
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joel CoehoornDirector of Information TechnologyCommented:
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).
allidapAuthor Commented:
In this case, the repeater generates a table in the HTML...

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

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

Joel CoehoornDirector of Information TechnologyCommented:
A repeater just generates html, and nothing more.  A grid will also provide hooks for your codebehind, so you can do something like this to directly access a specific cell:

GridView1.Rows(0).Cells(0).Text = "some text"
GridView1.Columns(0).ItemStyle.BorderColor = Drawing.Color.Black

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
allidapAuthor Commented:
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.