1

How would I go about doing this programatically?

I can do this just fine declaratively, using a template column and then using something like this:

    ...
<TemplateGridColumn>
    <ItemTemplate>
       <div>
          <asp:Image ID="groupImg" CssClass="groupImg" runat="server"/>
          <asp:Repeater ID="groupItemRpt" runat="server">
             <HeaderTemplate>
                <ul class="groupItemList">
             </HeaderTemplate>
             <ItemTemplate>
                <li>
                   <asp:Image ID="itemImg" runat="server" />
                   <asp:HiddenField ID="itemValue" runat="server" />
                </li>
             </ItemTemplate>
             <FooterTemplate>
                </ul>
             </FooterTemplate>
          </asp:Repeater>
       </div>
    </ItemTemplate>
    </TemplateGridColumn>
...

I am dynamically creating this grid based on the data, so I'm already added columns with one set of controls. But now I need to figure out how to show multiple images, which expand/contract if the groupImg image control is clicked (i just toggle the ul) ..

Can anyone point me in the right direction? Thanks.

Jim Counts
  • 12,535
  • 9
  • 45
  • 63
djbyter
  • 763
  • 8
  • 28

1 Answers1

0

This might not be the cleanest solution, but take a look at the FindControl() method. You can use it to loop though the grid items and find the repeater by its ID.

Jaguir
  • 3,620
  • 1
  • 19
  • 26
  • In what context? I need to make a new ITemplate class that can do the same thing as the declarative that I posted .. – djbyter Feb 19 '10 at 19:06
  • Perhaps I misunderstood your question. I was under the impression that you wanted to dynamically bind data to the repeater within the bound rows of the grid. – Jaguir Feb 19 '10 at 22:14