views:

165

answers:

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.

A: 

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.

Jared
In what context? I need to make a new ITemplate class that can do the same thing as the declarative that I posted ..
djbyter
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.
Jared